php-image-resize
php-image-resize copied to clipboard
Create from GD object
I've just written a converting library to convert all the common image formats from/to.
https://github.com/jenstornell/php-image-converter https://github.com/jenstornell/php-image-converter/issues/2
The pitfall of using it with this library is that I need to save the image two times, one for the format conversion and one for the resize.
That's because I can't create an image from a GD object. Here is a suggestion of how that could look like.
$image = ImageResize::createFromGD($gd_object);
$image->scale(50);
$image->save('image.jpg');
https://www.php.net/manual/en/function.imagejpeg.php https://www.php.net/manual/en/function.imagepng.php https://www.php.net/manual/en/function.imagewebp.php https://www.php.net/manual/en/function.imagegif.php
According to the one of image functions, the $gd_object type is resource?
I think we should consider following points if the author @adityapatadia will accept this feature request.
- Validate the
$gd_objecttype isresourcebefore manipulating the image. We can use the get_resource_type to handle this.
How about adding conversion functions to this library itself?