Reply to Re: Resize does not function

Re: Resize does not function new!
by Roderick, 16 years, 2 months ago
I rewrote it a bit. JPG and PNG now work, gifs get scrambled. Don't know why this happens.

if($this->file_src_mime == 'application/octet-stream') { 
  if (function_exists('mime_content_type')) { 
    switch($this->file_src_name_ext) { // Set mime manually
      case 'jpg':
        $this->file_src_mime == 'image/jpeg'; 
      break;
      case 'gif':
        $this->file_src_mime == 'image/gif'; 
      break;
      case 'png':
        $this->file_src_mime == 'image/png'; 
      break;
      default:
        $this->file_src_mime == '';
    } 
    // Set img src type to the file extension. Makes it a bit vulnurable
    $this->image_src_type = $this->file_src_name_ext; 
    // Flag set to true, otherwise 
    $this->file_is_image = true; 
  }						 
}					
// Now, the file faked as if its a normal image	

// if the file is an image, we gather some useful data
if (array_key_exists($this->file_src_mime, $this->image_supported)) { 		
  $this->file_is_image = true;
  $this->image_src_type = $this->image_supported[$this->file_src_mime];
  $info = @getimagesize($this->file_src_pathname);
  // $info now knows the file is not an genuine jpg image, so reset it again!
  if($this->file_src_mime == 'application/octet-stream') { 	
    $this->image_src_type = $this->file_src_name_ext;
  }
}
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important