sadovojav / yii2-image-thumbnail

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

not working form me #6

Closed gabriele-carbonai closed 8 years ago

gabriele-carbonai commented 8 years ago

Hello, I dont know why but for me is not working.

this is my code

echo Yii::$app->thumbnail->img( Yii::getAlias('@webroot/images/products/'.$r['images']), [
                       'thumbnail' => [
                        whidth' => 280,
                        'height' => 300,
                    ],
                    'placeholder' => [
                           'width' => 280,
                        'height' => 300
                    ]
            ]);

and produce this code

... src="/thumbnails/f5/f5e022a013b424919e87b5ece81cd7bc.jpg" ....

now, I am in local, I try to create a folder name thumbnails in:

applications/MAMP/htdocs

the getAlias is correct.

I make some error? thanks

sadovojav commented 8 years ago

@gomonkey Hey! Please show me your thumbnail config. I think you set wrong image path. Try to change image src to: '/images/products/' . $r['images'] This extension has this code:

$file = FileHelper::normalizePath(Yii::getAlias($this->basePath . '/' . $file));

And it has default basePath = @webroot.

You can set var_dump($file); die(); after this line and see full path to image;