I have a php script, which downloads, rescales and stores an image using the following command:
exec('convert -sample 100x100 http://someurl.com/pic.jpg images/somename.jpg');
It all worked fine until I put it on a different server (this one’s gentoo, if that makes any difference. Apparently convert won’t grab remote images, and if I feed it a url like above it returns
convert: missing an image filename 'images/somename.jpg' @ convert.c/ConvertImageCommand/2822.
I checked the use flags but nothing seems to relate to remote images…The new server is a local machine which I have root access to, so I can pretty much do whatever on it – so how can I make this work?
Another possibly related issue is that php’s file_get_contents() won’t get remote files from there either. Maybe it’s a system-wide setting somewhere preventing binaries from getting remote files? Has anyone had an issue like this before? How did you solve it?
Thanks,
Mala
Update: To clarify
This problem (imagemagick) has nothing to do with PHP. It’s on my laptop which can access the internet just fine, and is not related to firewalls. If I open up a shell and type
convert -sample 100x100 http://someurl.com/pic.jpg images/somename.jpg
it fails with the above error without even trying to access the internet. ‘wget’ on the other hand, as well as web-browsers etc work just fine. On other systems, the convert command when typed into a shell works with no errors.
Please disregard the file_get_contents problem as I believe it is not related for the reasons above
Rather unintuitively, imagemagick must be compiled with the xml support in order to load remote images. Thus, Gentoo users will need to enable the xml useflag.