1

I have a script that dynamically alters an image. I would like to read the dynamically generated image into another PHP script. What I mean is:

$image = imagecreatefromjpeg('effect.php?path=pic.jpg');

However this does not work. What can I do? Obviously I could attempt to combine the scripts, but my question is, is there another way? Can I read a dynamically generated image into imagecreatefromjpeg?

Thank you!

Leopold Joy
  • 4,524
  • 4
  • 28
  • 37
  • What doesn't work? What error is thrown? Is there a file there? conceptually, this is possible, but we'd need to see a bit more. – random_user_name Feb 22 '14 at 23:54
  • Yes, sorry! Here is the warning: Warning: imagecreatefromjpeg(effect.php?path=pic.jpg): failed to open stream: No such file or directory in /ThisIsThePath/effect.php on line 20 – Leopold Joy Feb 23 '14 at 00:20

1 Answers1

0

The image must be directly loaded into that function. You cant ask it to evaluate a php path.

Jack M.
  • 1,195
  • 13
  • 30
  • Could I directly load it in from an external PHP file? Is this at all possible? Or must the image be entirely generated in the same PHP file? – Leopold Joy Mar 05 '14 at 06:43
  • Well, yes, if you call the function in that external file to create the image and that function returns the image path. You could include effect.php and call the function to which you pass the path, depending on the code in that effect.php file. That's why its a good idea to share your code. – Jack M. Mar 05 '14 at 12:02