January 19th, 2004, 02:26 PM
I need to convert a gif to a jpg in realtime
I am looking for a script that will convert a gif picture to either a jpg or a png in realtime.
So that convert.php?picture.gif.jpg or whatever returns a jpeg of the original image picture.gif.
I need it to work with PHP or Perl (prefferably PHP) in a Linux enviroment. I do not have root access. I can use binaries such as NETPBM. Any ideas?
January 19th, 2004, 03:03 PM
Is imagemagick installed?
January 20th, 2004, 10:04 AM
imagemagick is not installed but I could install it. NETPBM is installed. What do I need to make it work?
January 20th, 2004, 10:33 AM
I found the answer, thanks to Andrew.
$netpbmPath = "/fill/this/in/with/the/netpbm/path"; //don't put a slash on the end
header ("Content-Type: image/png");
$file = $_SERVER['QUERY_STRING'];
echo `$netpbmPath/giftopnm $file | $netpbmPath/pnmtopng`;