spatie / laravel-glide

Easily convert images with Glide
https://freek.dev/2015/12/easily-convert-images-with-glide/
MIT License
424 stars 51 forks source link

setManipulations Watermark path #52

Closed philmarc closed 8 years ago

philmarc commented 8 years ago

I am trying to add a watermark to my image:

$this->addMediaConversion('large')
    ->setManipulations(['fm' => 'jpg', 'mark' => 'watermark.png', 'markw' => '40', 'markh' => '40', 'markpad' => '15', 'markpos' => 'top-left'])
    ->performOnCollections('images');

Following the Glide doc (http://glide.thephpleague.com/1.0/api/watermarks/) I added a new filesystem for watermarks, in the laravel's config/filesystems.php file.

However, my generated thumb doesnt have any watermark on it. And there is no log error report.

Where should I place my watermark.png file ? I tried in storage/images and storage/watermarks and even modifying 'mark' => storage_path('images/watermark.png') but I can't get it working.

freekmurze commented 8 years ago

Could try using the absolute path to your watermark file?

tlandn commented 8 years ago

Hi, I tried absolute path

GlideImage::create(public_path().'/uploads/posts/cropped-1555.jpg') ->modify(['mark' => '/home/vagrant/Code/mysite/public/uploads/posts/mark-100h.png']) ->save(public_path(). '/output.jpg');

with no luck.

freekmurze commented 8 years ago

This has been fixed in v.3.0.1. You can now use the absolute path in the mark parameter.

philmarc commented 8 years ago

Tested it on local and production, works like a charm using public_path() Thanks for the fix!