#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    349
    Rep Power
    12

    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?

    Thanks,
    Hank
  2. #2
  3. No Profile Picture
    Got source?
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2003
    Location
    Laguna Niguel, California, USA
    Posts
    2,331
    Rep Power
    14
    Is imagemagick installed?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    349
    Rep Power
    12
    imagemagick is not installed but I could install it. NETPBM is installed. What do I need to make it work?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    349
    Rep Power
    12
    I found the answer, thanks to Andrew.

    PHP Code:
    <?php 
    $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`; 
    ?>

IMN logo majestic logo threadwatch logo seochat tools logo