sadovojav / yii2-image-thumbnail

Create image thumbnail Yii2 component
GNU General Public License v3.0
21 stars 12 forks source link

PLACEHOLDER_TYPE_JS and PLACEHOLDER_TYPE_IMAGINE ignore yii base URL #11

Closed h0lg closed 4 years ago

h0lg commented 5 years ago

It seems to me that the placeholder types PLACEHOLDER_TYPE_JS and PLACEHOLDER_TYPE_IMAGINE ignore the Yii base URL (see https://www.yiiframework.com/doc/guide/2.0/en/concept-aliases#predefined-aliases ).

That is, if your app is running at www.tld.com/path/to/app/ instead of at www.tld.com/, placeholder URLs will be generated for the root of the path: with PLACEHOLDER_TYPE_JS: www.tld.com/holder.js?params=... (HTTP 404) instead of www.tld.com/path/to/app/assets/.../holder.js?params=... with PLACEHOLDER_TYPE_IMAGINE : www.tld.com/thumbnails/... (HTTP 404) instead of www.tld.com/path/to/app/thumbnails/...

I'm using these settings:

    'thumbnail' => [
        'class' => 'sadovojav\image\Thumbnail',
        'cachePath' => '@webroot/thumbnails',
        'prefixPath' => '@web',
        'options' => [
            'placeholder' => [
                'type' => sadovojav\image\Thumbnail::PLACEHOLDER_TYPE_IMAGINE
            ]
        ]
    ],

Am I missing or misunderstanding something?

Edit: I think https://github.com/sadovojav/yii2-image-thumbnail/pull/9 could be related.

sadovojav commented 5 years ago

@forger Now you can use prefixPath to placeholder to. For example: config: https://take.ms/UDGC93

'thumbnail' => [
            'class' => 'sadovojav\image\Thumbnail',
            'cachePath' => '@webroot/thumbnails',
            'prefixPath' => '@web/frontend/web',
            'options' => [
                'placeholder' => [
                    'type' => sadovojav\image\Thumbnail::PLACEHOLDER_TYPE_IMAGINE,
                    'backgroundColor' => '3a3d3f',
                    'textColor' => 'fff',
                    'text' => 'Ooops!'
                ],
                'quality' => 100,
            ]
        ],

result: https://take.ms/6KkFu

/frontend/web/thumbnails/2e/2eedaa57ac9cd8844c0988d35a91887d.jpg

If you want, you can set on prefixPath site url with some path what you need

h0lg commented 5 years ago

Aww man, you're on fire! I can't open issues as fast as you fix them :) Did I subscribe to pro-level support without noticing? I'll test that as soon as I can rub two minutes together and get back to you. Thank you so very much and keep up the good work!

h0lg commented 5 years ago

Hey Alex, the packigist package at https://packagist.org/packages/sadovojav/yii2-image-thumbnail#dev-master didn't update and is still at 62b283aa43d7bc6f0d13a64c78ac0f79c3faf22b which is the second-to-last commit on the master from Jan 15. Could you look into that? Maybe there's something wrong with the update hook? Here's a packagist issue for reference: https://github.com/composer/packagist/issues/200 . Thanks, dude!

Edit: I see that the description of the package was updated though. I notice that the package name is "dev-master" instead of "master" which is the name of the branch your commits are on - did you maybe recently rename the github master branch? Maybe packagist is trying to pull from a now non-existing branch?

sadovojav commented 5 years ago

@forger, Sorry, I had vacation :) I checked packagist, and it has a new code. Please check in yourself.

h0lg commented 5 years ago

Hey Alex, I checked https://packagist.org/packages/sadovojav/yii2-image-thumbnail#dev-master and it still reads

62f070d3212481e5e716901f2568b1023c8e18df next to the owner & license info, although the package info from the readme was obviously updated.

Also, I am guessing you meant check it instead of in. Otherwise, what can I check in?

On 2 May 2019 9:46 am, at 9:46 am, Aleksandr Sadovoj notifications@github.com wrote:

@forger, Sorry, I had vacation :) I checked packagist, and it has a new code. Please check in yourself.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/sadovojav/yii2-image-thumbnail/issues/11#issuecomment-488580227

h0lg commented 4 years ago

packigist has since updated and all is working well now, thanks :)