image icon indicating copy to clipboard operation
image copied to clipboard

Found the opacity() not working in jpg format

Open romeltech opened this issue 4 years ago • 3 comments

I also have an issue on opacity when working on jpg format, png files are fine tho. Image::make('public/foo.jpg')->opacity(50); The execution time for more than 30 seconds

romeltech avatar Sep 18 '20 16:09 romeltech

JPEG format doesn't support transparency.

vlakoff avatar Jan 20 '21 00:01 vlakoff

Hi, I updated my php to version to 8 and suddenly the code below stopped working.

Exception: throw new NotReadableException("Image source not readable"); Intervention::make(public_path('images/logo.png'))->opacity(50);

But it will work when i removed the ->opacity(50).

Any ideas?

jurerick avatar May 16 '21 14:05 jurerick

Does the following give you true?

var_dump( (bool) filter_var(public_path('images/logo.png'), FILTER_VALIDATE_URL) );


By the way, as you are using public_path(), you are pointing to an external URL (i.e. "http: //www.your-site.com/images/logo.png"). That's very inefficient (it fetches the image from HTTP), you should consider using resource_path() instead to read the file locally.

vlakoff avatar May 16 '21 16:05 vlakoff

The implementation of this function was rather poor and very resource-hungry. I decided to drop this function in the new version 3 of Intervention Image.

olivervogel avatar Dec 08 '23 18:12 olivervogel