Jump to content


  • Posts

  • Joined

  • Last visited

Contact Methods

  • AIM
  • Website URL

Profile Information

  • Gender
    Not Telling

mcmuney's Achievements

Advanced Member

Advanced Member (4/5)



  1. I'm using a gd library script to resize images that are uploaded. -All images that are uploaded are renamed with a .jpg extension. -When the original images is .jpg or .jpeg, I can see the image and resize it without any issues. -But when the original image is a .gif or a .png, I cannot view or resize the image -I'll get an error, "JPEG library reports unrecoverable error.. $filename is not a valid JPEG file" -This is the line that tells it to look for jpg/jpeg file: $func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' : $ext); -If the original is a .png, if I replace the 'jpeg' above with 'png', then it works, but obviously, it no longer works with .jpg files My question, how can I modify the line above to specify for jpg, jpeg, png and gif? I tried this, but it wouldn't work: $func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' ? 'png' ? 'gif' : $ext); Here's the full portion of the code: function loadImage($filename) { $ext = strtolower($this->_getExtension($filename)); $func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' : $ext); if (!$this->_isSupported($filename, $ext, $func, false)) { return false; } $this->_imgOrig = $func($filename); if ($this->_imgOrig == null) { $this->_debug("The image could not be created from the '$filename' file using the '$func' function."); return false; }
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.