PHP Image Thumbnail Problem

Discussion in 'Programming' started by jrp1, Jan 23, 2009.

  1. #1
    I'm using a code that displays images from a directory and turns them into thumbnails. In the code:

      if ($image_format==1) {
      $old_image=imagecreatefromgif($filename);
     } elseif ($image_format==2) {
      $old_image=imagecreatefromjpeg($filename);
     } elseif ($image_format==3) {
      $old_image=imagecreatefrompng($filename);
     } else {
      exit;
     }
    Code (markup):
    the "imagecreatefrompng" isn't working, as only JPGs and GIF's show on the list. Any ideas on how to fix this?
     
    jrp1, Jan 23, 2009 IP
  2. jrp1

    jrp1 Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    do'h. I changed:

    if ($ext!='gif' && $ext!='jpg') continue;
    Code (markup):
    to:

    if ($ext!='gif' && $ext!='jpg' && $ext!='png') continue;
    Code (markup):
    and that did the trick.
     
    jrp1, Jan 23, 2009 IP