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.
No, it is not possible to know the size of the image prior to resizing, at least not in the class itself. The X and Y sizes are retrieved when you call process(), not before.
However, you can read some class variables before calling process(). For instance, you can read $foo->file_src_name which gives you the filename of the just-uploaded file. From there, you can get the size of your picture, outside of the class, and then call process() with different options.Reply
let's say we got the name of the uploaded file with $foo->file_src_name, is there a way to get the full path where the file has been uploaded?
I would like to check the mime and size of the uploaded file before the action, so I need to use file_exists() and getimagesize() functions and for this I need to know the full path to the file. Documents say it is /tmp/ but is this always true?Reply
However, you can read some class variables before calling process(). For instance, you can read $foo->file_src_name which gives you the filename of the just-uploaded file. From there, you can get the size of your picture, outside of the class, and then call process() with different options.
I would like to check the mime and size of the uploaded file before the action, so I need to use file_exists() and getimagesize() functions and for this I need to know the full path to the file. Documents say it is /tmp/ but is this always true?