-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue reading GDImage object using \Imagine\Gd\Imagine read() method #834
Comments
$file_contents = file_get_contents($path);
$imagine_object = new Imagine\Gd\Imagine();
$imagine_object->load($file_contents); Or if you need to handle existing GD resources you could use the class factory to create an image from that: $gd_resource = imagecreatefromstring(file_get_contents($path)); // in php 8 creates a GDImage object
(new Imagine\Factory\ClassFactory())->createImage(
Imagine\Factory\ClassFactoryInterface::HANDLE_GD,
$gd_resource,
new Imagine\Image\Palette\RGB(),
new Imagine\Image\Metadata\MetadataBag(),
); |
Hi - that's super helpful thanks. |
I don’t know. I usually read the source code directly to find out how it is meant to be used. |
Issue description
When trying to read an existing GDImage object into an Imagine\Gd\Imagine object I get an exception
Variable does not contain a stream resource
Unclear from manual whether there is a way / how to insert a GDImage object into an Imagine 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:
The text was updated successfully, but these errors were encountered: