CostaRico / yii2-images

Yii2-images - behavior-based module for resizing, storing, caching and attaching images.
160 stars 98 forks source link

Original name for image #80

Open Mandzuk opened 6 years ago

Mandzuk commented 6 years ago

Hi. How can I save the original name of the picture? It`s important for SEO

Inkognitoo commented 6 years ago

Method attachImage takes three argument: absolute path to file (string), is it main image (bool) and original name for file (string). For example: $model->attachImage('/tmp/dsftsdf.png', false, 'It is image original name')

Mandzuk commented 6 years ago

Thank you. But I'm more interested the name of the file. I added a name, the name is saved in the table http://joxi.ru/zAN41wMtlWkLZm . But the link remains http://joxi.ru/DmB4d9gtNDMyMA . And I need, that would be in the link to the file my name was written

erzhigit commented 6 years ago

I did it like this! in model $name = $this->image->baseName; $this->attachImage($path,$isMain,$name);

in view.php add attribute alt alt='{$img->name}',