I'm having an issue trying to use Intervention Image to manipulate webp files. The statement causing the error is:
Image::make($image->getRealPath())->resize(250, 250)->save($path);
The error I run into is:
Unsupported image type. GD/PHP installation does not support WebP format.
I have the gd library installed, however it does not support webp.
I've looked around, and the closest I've found to a solution is here, which suggests adding additional extensions when initially (manually) compiling PHP: Call to undefined function imagewebp()
I would prefer not to uninstall and manually compile PHP with additional extensions. Is this the only option? Are there any straightforward solutions?
Related
Is it possible to enable gd webp support in PHP 7.4 on debian (with nginx) without recompiling php? All solutions I found recompile PHP7 with the --with-webp-dir param.
You can sort of do it. Save an image file on your server, and then convert it to WebP.
See: How to Enable WebP support Php 7 without Recompiling?
I agree, it is not perfect, but quite close.
When I want to install the CMS TYPO3, following problems get detected:
PHP GD library true color support broken
GD is loaded, but calling imagecreatetruecolor() fails. This must be fixed, TYPO3 CMS won't work well otherwise.
PHP GD library gif support broken
GD is loaded, but calling imagecreatefromgif() fails. This must be fixed, TYPO3 CMS won't work well otherwise.
PHP GD library png support broken
GD is compiled with png support, but calling imagecreatefrompng() fails. Check your environment and fix it, png in GD lib is important for TYPO3 CMS to work properly.
When I search for PHP GD2 in my apache server I can only find GD without the 2 - ist this a problem?
There are also some yellow colored problems - do I also have to fix these?
I had the same problem when running the latest wersion of XAMPP as it include PHP v8.
I installed an older version of XAMPP with php v 7.4.13 and the problem seems gone.
I intend to use a serverless php function to generate an image with TrueType fonts. In order to do that, I chose bref with Serverless framework and composer.
To process the image and include the text, I'm using imagettftext function from gd library. I ran php -S localhost:8000 index.php for local testing purposes. It worked fine, I got the output image as I expected it.
Thus I ran composer install --optimize-autoloader --no-dev and then serverless deploy to create a AWS Lamda function. However, when I called the deployed function's endpoint, it showed a Slim Application Error - without any detail:
A website error has occurred. Sorry for the temporary inconvenience.
So I took a look at AWS Cloudwatch logs and found this error message:
Message: Call to undefined function imagettftext()
Searching about this error, I found out it's often related to gd library missing. Then I compared phpinfo() from local test to the one from deployed function. Both have gd installed, the difference is that the local one has FreeType Support enabled.
Could you help me to find a way to enable this FreeType Support also for the serverless function? Is it possible to require this support through composer.json?
There's an issue open on GitHub at the moment regarding compiling PHP with freetype support, which explains the result you're seeing: https://github.com/brefphp/bref/issues/497.
GD needs to know about freetype as it's compiled into PHP, so I doubt you would be able to include it with composer
imagick convert command is not working for this webp image -
https://lh3.googleusercontent.com/VRY0O_3L8VH2wxJSTiKPr72PeM5uhPPFEsHzzYdxenddpTI150M0TYpljnZisQaROR0=h256-rw -
convert -resize 50x50! https://lh3.googleusercontent.com/VRY0O_3L8VH2wxJSTiKPr72PeM5uhPPFEsHzzYdxenddpTI150M0TYpljnZisQaROR0=h256-rw /var/test_sandeepan/output.jpg
Output -
convert: no decode delegate for this image format `WEBP' # error/constitute.c/ReadImage/535.
From this, I conclude that webp is either not supported by Imagick at all, or not supported by this version.
A link shared in this answer, talks about webp support along with imagemagick and php, so I thought imagick must be supporting webp as well, because PHP imagemagick, as per my understanding is nothing but a wrapper class to the imagick utility. Please correct me if I am wrong here.
I conclude that webp is either not supported by Imagick at all, or not supported by this version.
Imagick doesn't really do anything. All it does is convert PHP function calls into C function calls, to call the ImageMagick code through its 'wand' API.
If you want to have ImageMagick support webp, you will either need to install a version that has been compiled with webp support compiled in, or compile it yourself: http://www.imagemagick.org/script/advanced-unix-installation.php
You'll need to install libwebp-devel either from apt/yum, or from https://github.com/webmproject/libwebp as ImageMagick relies on that 'delegate' code being there to read/write webp images.
is it possible to check the php imagick extension for ghostscript support?
for example if it is turned on / off, the ghostscript version used, etc.
which possibilities are there to get additional ghostscript / pdf details?
the only thing i've found so far is this (version of imagick lib itself):
http://php.net/manual/en/imagick.getversion.php
ps: no system calls are allowed (e.g. exec) from within php
I don't know much about imagick, but some things about imagemagick. My guess is that by reading this answer related to imagemagick could help you with imagick as well:
convert -list delegate | grep -Ei '(PDF|PS|EPS)'
(convert is one of the CLI utilities which are part of imagemagick.)