Reputation: 15259
Is there a way, to resize images with formats: GIF
, PNG
, JP(E)G
, without installing additional classes like Imagick?
The most important thing is that images can't lose their transparency (PNG, GIF) and also in case if it's animated, resize it, but without losing GIF
animation.
Upvotes: 2
Views: 1105
Reputation: 1281
php has an extension called GD
that should be installed
that you can use. On the page above are a bunch of examples to do exactly what you want to do. I personally haven't used it for animated GIF images, but have for the other image formats. One thing though is that JPEG images use A LOT of RAM with this library because the library decompresses the JPEG image into its byte format - essentially making it the equivalent of a 16.7 Million color Bitmap.
To see if the extension is loaded you can call the extension_loaded('GD')
function and it will return TRUE
if it is. Or you can type at the command-line php -m
and see all the extensions there. php -m | grep -i gd
should do it.
Just to be clear, the GD
library is not very efficent so reconsider using the Imagick extension.
EDIT: Resize image sample using GD Extension
Upvotes: 1