class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I've implemented this code (i dont know this forums bb-code. so just as plain text) at row 2258
Now, flash upload and image resizing works, but only for jpg files. All i do is manually resetting some vars to jpg so the upload class will process the images as jpg's.
// Some logging to chech mime of file
$this->log .= 'EDIT - 1e file src mime : '.$this->file_src_mime;
if($this->file_src_mime == 'application/octet-stream') {
$this->log .= 'EDIT - File is octet-stream';
if (function_exists('mime_content_type')) {
// SET mime type manually.
// File HAS to be jpg in order to work properly.
// GIF support and PNG support not included
$this->file_src_mime == 'image/jpeg';
// Get image info
$info = @getimagesize($this->file_src_pathname);
// Set img src type manually. Again, file has to be jpg!
$this->image_src_type = 'jpg';
$this->file_is_image = true;
}
}
// Now, the file is an jpg-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 i reset it again!
if($this->file_src_mime == 'application/octet-stream') {
$this->image_src_type = 'jpg';
}
}
// Just some log checking
$this->log .= 'EDIT - 3de file src mime : '.$this->file_src_mime;
Now, flash upload and image resizing works, but only for jpg files. All i do is manually resetting some vars to jpg so the upload class will process the images as jpg's.