Remote images in SVG not retrieved when run on Web server
Posted: 2009-11-18T12:10:33-07:00
I have a perl program running on my Web server that allows you to upload an SVG file and have it converted into a JPEG, using ImageMagick's "convert" program. It works perfectly, except for one thing: remote images (included in the xlink attribute of an <image> tag) are not included. They ARE downloaded and included in the JPEG if I run the program from the command line, however. It's only when I run /usr/bin/convert from the Web that I have problems.
Here's a minimalist .svg file that illustrates the problem:
Again, this works perfectly if I issue the following command at a Unix prompt on the server: /usr/bin/convert test.svg test.jpg
It only fails to retrieve the background if convert is invoked from within a CGI script on the Web server. So it seems to be a permissions issue within ImageMagick. (Other perl programs have no qualms about retrieving similar remote data.)
This is "ImageMagick 6.2.8 04/17/08 Q16", installed via yum on CentOS. Any ideas?
Here's a minimalist .svg file that illustrates the problem:
Code: Select all
<svg height="302" width="600" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<image width="600" height="302" id="map" x="0" y="0" xlink:href="http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&styles=&srs=EPSG:4326&bbox=-122.0574699,36.8846530,-121.7583218,37.0051803&WIDTH=600&HEIGHT=302&format=image/jpeg" />
</svg>
It only fails to retrieve the background if convert is invoked from within a CGI script on the Web server. So it seems to be a permissions issue within ImageMagick. (Other perl programs have no qualms about retrieving similar remote data.)
This is "ImageMagick 6.2.8 04/17/08 Q16", installed via yum on CentOS. Any ideas?