Description
Issue description
The getGdResource() method extracts the GDResource component from a GD type Image object.
However there does not appear to be any clean way to generate or update the Image object from a GDResource type entity.
This is unfortunate.
If (for example) if you need to apply a process to an image for which no Image methods exist (e.g. apply an arbitrary laplacian type filter) then the only option (in GD universe) is to export the image resource, apply the process using GD primitives and then ... you are stuck. The Imagine read() method apparently only reads GD resources from disk, so it would appear to proceed with processing you need to write the partially processed image to disk and read it back again (or if that doesn't work, write out partially processed image in an image file format and create a new Image instance by reading that back again).
A better solution would be for there to be a way to simply load a GD resource back into the Image object.
...
What version of Imagine are you using?
1.3.2
What's the PHP version you are using?
8.0.25
What's the imaging library you are using [gd/imagick/gmagick/any]?
GD2
What's the imaging library configuration
GD Version: "2.3.3"
FreeType Support: true
FreeType Linkage: "with freetype"
GIF Read Support: true
GIF Create Support: true
JPEG Support: true
PNG Support: true
WBMP Support: true
XPM Support: true
XBM Support: true
WebP Support: true
BMP Support: true
TGA Read Support: true
JIS-mapped Japanese Font Support: false
Minimal PHP code to reproduce the error:
$imagine_object = new Imagine\Gd\Imagine(); // Creates new Imagine GD object
$image_object = $imagine_object->load($image); // Creates a new Image GD object
$gd_resource = $image_object->getGdResource();
... do stuff ...
$modified_image_object = $imagine_object->read($gd_resource); // Fails... :(