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.
first thanks for this genius piece of software. Just one thing: The image_auto_rotate function is very slow on large pictures and takes endless.
I looked in the code and saw that you are using a nested for loop with the imagecopy() function. So that should be the reason why this thing lasts forever.
Could you change that please, maybe you could use the imagerotate() function?
I have some update for you. Haven't heard of you for a long time, so I did some code changes myself regarding the veeeery slow image_auto_rotate and auto_flip functions. (In fact sadly these aren't real functions but simple if-statements, if these would have been functions/methods I could have easily extended your class and create overrides methods...)
Here is the code I changed: In your $auto_flip statement you need to replace this (Old):
Thank you very much. Tbh, I have no spre time right now to implement and test it, but I have written down your code, and will try to integrate it as soon as possible.Reply
first thanks for this genius piece of software.
Just one thing:
The image_auto_rotate function is very slow on large pictures and takes endless.
I looked in the code and saw that you are using a nested for loop with the imagecopy() function. So that should be the reason why this thing lasts forever.
Could you change that please, maybe you could use the imagerotate() function?
Thank you!!
Maybe something like here: https://github.com/verot/class.upload.php/issues/8#issuecomment-128879652
https://www.php.net/manual/de/function.imagerotate.php#121741
I have some update for you.
Haven't heard of you for a long time, so I did some code changes myself regarding the veeeery slow image_auto_rotate and auto_flip functions. (In fact sadly these aren't real functions but simple if-statements, if these would have been functions/methods I could have easily extended your class and create overrides methods...)
Here is the code I changed:
In your $auto_flip statement you need to replace this (Old):
with this (New):
And in your $auto_rotate statement you need to replace this (Old):
with this (New):
To make it rotate the images correctly you also have to change your exif-orientation cases to this (New):
Hope you can use it!
This will make the uploadtimes with image-rotation a lot faster!