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.
Hello, When I run phpinfo(), I see the upload_max_filesize and post_max_size is 20M. When I put a customized php.ini in root and change the parameteres
upload_max_filesize = 1M post_max_size = 1M
it makes no difference. When run phpinfo() after this, I still see 20M.
What should I do to change every uploaded images that greater than 1M exactly to 1Mb? I tried changing some parameters like $handle->image_max_width, $handle->image_max_height, $handle->image_max_pixels but I could only decrease the size a little (for example 5 M file to 2 MB).
Another way I tried is that in class.upload.php I changed the line $this->file_max_size = $val; to $this->file_max_size = 1048576;
It only uploads images that equals or smaller than 1 MB. If the image is greater than 1 MB, upload process doesn't work normally. I can use the script like this but I will always have to resize the images manually before upload.
The limits in php.ini depend on your system, the way PHP is set up, the permissions that you have, etc... Check with your hosting company what you can do.
If you want to resize images larger than 1MB, down to approximately 1MB, you can use this:
When I run phpinfo(), I see the upload_max_filesize and post_max_size is 20M. When I put a customized php.ini in root and change the parameteres
upload_max_filesize = 1M
post_max_size = 1M
it makes no difference. When run phpinfo() after this, I still see 20M.
What should I do to change every uploaded images that greater than 1M exactly to 1Mb? I tried changing some parameters like $handle->image_max_width, $handle->image_max_height, $handle->image_max_pixels but I could only decrease the size a little (for example 5 M file to 2 MB).
Another way I tried is that in class.upload.php I changed the line
$this->file_max_size = $val; to $this->file_max_size = 1048576;
It only uploads images that equals or smaller than 1 MB. If the image is greater than 1 MB, upload process doesn't work normally. I can use the script like this but I will always have to resize the images manually before upload.
Thank you for your help.
If you want to resize images larger than 1MB, down to approximately 1MB, you can use this:
Note that it works only with JPEG images.