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 upload an image and scale them to one big image and one thumb (works fine)
After upload and resize I have same editing options, like rotate, add border and crop. This works fine when I do changes on both big image and thumb but give me problems when only one of them is changed.
I need to get $handle->process to be true on both images even if I don't change anything on one of them but I get no process at all. (eg I want copy unchanged image).
In log my script terminates with this: - no image processing wanted
Here is the logic, my problem occur when $borderact == 'small':
I don't understand fully what you want to do. So you have some images (large and thumbnail) already on the disk, and you want to process them locally.
Then you want to process them both, applying some transformation one both of them, or only one? And it works only when it applies the effects on both of them?
You say that you need to have $handle->process to be true. That is not strictly correct. You need to call $handle->process() twice, once for each image. In between each call to process(), don't forget that all the parameters are reset.
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 upload an image and scale them to one big image and one thumb (works fine)
After upload and resize I have same editing options, like rotate, add border and crop.
This works fine when I do changes on both big image and thumb but give me problems when only one of them is changed.
I need to get $handle->process to be true on both images even if I don't change anything on one of them but I get no process at all. (eg I want copy unchanged image).
In log my script terminates with this:
- no image processing wanted
Here is the logic, my problem occur when $borderact == 'small':
Then you want to process them both, applying some transformation one both of them, or only one? And it works only when it applies the effects on both of them?
You say that you need to have $handle->process to be true. That is not strictly correct. You need to call $handle->process() twice, once for each image. In between each call to process(), don't forget that all the parameters are reset.
Could you paste here your log(s)?
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.