Git Product home page Git Product logo

Comments (3)

ausi avatar ausi commented on August 24, 2024

Imagine\Gd\Imagine::read() can only handle resources that point to files, not GD resource objects.
So your code should probably look like this:

$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(),
);

from imagine.

jcogs-design avatar jcogs-design commented on August 24, 2024

Hi - that's super helpful thanks.
Am just getting head around Imagine and finding the documentation quite terse: great as a reference for specific methods, but not so useful for getting a handle on approach used by library. Such illustrative information as I have found so far dates from 2011, and not useful for current version of library.
Do you know if there are good sources of information on use of the library beyond the docs?
Thanks!

from imagine.

ausi avatar ausi commented on August 24, 2024

Do you know if there are good sources of information on use of the library beyond the docs?

I donโ€™t know. I usually read the source code directly to find out how it is meant to be used. โ˜บ๏ธ

from imagine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.