0

I am currently looking to get the binary file's contents through a resource which is given by the function

imagecreatefromstring()

I've looked at the documentation on php.net and have been unable to find an answer to my question, the function is

resource imagecreatefromstring ( string $image )

I want to be able to do something like

file_get_contents(imagecreatefromstring(file_get_contents("file data from a regular file"));

This is because I am working on an image class, and it has a 'recreate' functionality, this'll recreate the image and return a new object with the new file's binary content, etc.

Is there any way to get the binary file contents from this resource? Or am I looking at the wrong place

Thanks in advance.


Documentation for imagecreatefromstring: here

pandaJuan
  • 91
  • 1
  • 11
  • 1
    Possible duplicate of [PHP GD: How to get imagedata as binary string?](https://stackoverflow.com/questions/1206884/php-gd-how-to-get-imagedata-as-binary-string) – CBroe Feb 26 '18 at 13:34
  • Does your server have Imagick installed? Its much more robust and has built ins for things like this too. If its a possibility, you may wish to read into that class object. – IncredibleHat Feb 26 '18 at 14:33

0 Answers0