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 do call process twice and have separated them: $handle->... and $thandle->...
I need this for two reasons, I verify the actions with $handle->processed()/$thandle->processed() and output images or errormessage from that result. I also need $handle->image_dst_x and $handle->image_dst_y for the next step in my "application".
I guess I can find a workaround but that will involve sending image dimensions thru the form and a more complex error-checking logic.
Here is my log in the described situation: system information
Thanks for your fast reply Colin, and your good class!
I did some rewriting of my code and ended up with something that works for me. (image dimensions thru the form and a slightly more complex error-checking...)
But I still think that it should be posible to load the image data, do nothing really, and then write it back to file and get $handle->processed = true...well I'm just an amateur in this field.Reply
I still don't really understand, but here is a suggestion (from the docs!) that may help you. You can read the following values before calling Process():
Values that can be read before calling process() * file_src_name: Source file name * file_src_name_body: Source file name body * file_src_name_ext: Source file extension * file_src_pathname: Source file complete path and name * file_src_mime: Source file mime type * file_src_size: Source file size in bytes * file_src_error: Upload error code * file_is_image: Boolean flag, true if the file is a supported image type
If the file is a supported image type (and open_basedir restrictions allow it) * image_src_x: Source file width in pixels * image_src_y: Source file height in pixels * image_src_pixels: Source file number of pixels * image_src_type: Source file type (png, jpg, gif or bmp) * image_src_bits: Source file color depth
Also, you can call process() twice on the same image (uploaded or local file) without having to instantiate the class twice.Reply
I need this for two reasons, I verify the actions with $handle->processed()/$thandle->processed() and output images or errormessage from that result. I also need $handle->image_dst_x and $handle->image_dst_y for the next step in my "application".
I guess I can find a workaround but that will involve sending image dimensions thru the form and a more complex error-checking logic.
Here is my log in the described situation:
system information
I did some rewriting of my code and ended up with something that works for me.
(image dimensions thru the form and a slightly more complex error-checking...)
But I still think that it should be posible to load the image data, do nothing really, and then write it back to file and get $handle->processed = true...well I'm just an amateur in this field.
Values that can be read before calling process()
* file_src_name: Source file name
* file_src_name_body: Source file name body
* file_src_name_ext: Source file extension
* file_src_pathname: Source file complete path and name
* file_src_mime: Source file mime type
* file_src_size: Source file size in bytes
* file_src_error: Upload error code
* file_is_image: Boolean flag, true if the file is a supported image type
If the file is a supported image type (and open_basedir restrictions allow it)
* image_src_x: Source file width in pixels
* image_src_y: Source file height in pixels
* image_src_pixels: Source file number of pixels
* image_src_type: Source file type (png, jpg, gif or bmp)
* image_src_bits: Source file color depth
Also, you can call process() twice on the same image (uploaded or local file) without having to instantiate the class twice.