Configurable jpeg quality on Multi Uploader resize
Posted: 23 Jan 2013, 17:18
As usual people are too lazy to resize their images before upload. I'm too lazy to do it, too.
So, currently phoca has integrated functionality for resizing images through Multiple Uploader before upload. Unfortunately, this method does not allow to control quality of resized images. So, if user will upload huge 3Mb file with 5000x5000 px, after resizing with my settings this file will be 1000x1000 px, but occupies about 1Mb disk storage on server. It is too much, as I think. Sometimes no sense to store user files with 100% jpeg quality.
So, changes below will allow you to configure your own jpeg quality for resizing images before upload. Hope unified diff format will no cause any problems for reading and understanding. Also hope these changes will be included in nearest Phoca Gallery releases.
P.S. Unfortunately, I wasn't able to include my changes into the post due to maximum number of allowed characters limit, so you can download it by the following link: http://scooterclub.by/kot/diffs/phoca_u ... ality.diff
P.P.S. Currently Flash uploader (at the lease Flash one) has defect with image resize on upload: if resized image size larger then original, so Multi Uploader will send to server only count of bytes equals to original image, not to modified. And uploaded image will be broken.
Example: original image is highly compressed, 50% jpeg compression, takes 200 kb. After resizing with 100% new file will takes about 1 mb. But only first 200 kb of newly created file will be sent to server.
In addition, the following modification also would be useful for all who will venture to install the changes above: If Multiple Upload is enabled, don't show single file upload form to user.
So, currently phoca has integrated functionality for resizing images through Multiple Uploader before upload. Unfortunately, this method does not allow to control quality of resized images. So, if user will upload huge 3Mb file with 5000x5000 px, after resizing with my settings this file will be 1000x1000 px, but occupies about 1Mb disk storage on server. It is too much, as I think. Sometimes no sense to store user files with 100% jpeg quality.
So, changes below will allow you to configure your own jpeg quality for resizing images before upload. Hope unified diff format will no cause any problems for reading and understanding. Also hope these changes will be included in nearest Phoca Gallery releases.
P.S. Unfortunately, I wasn't able to include my changes into the post due to maximum number of allowed characters limit, so you can download it by the following link: http://scooterclub.by/kot/diffs/phoca_u ... ality.diff
P.P.S. Currently Flash uploader (at the lease Flash one) has defect with image resize on upload: if resized image size larger then original, so Multi Uploader will send to server only count of bytes equals to original image, not to modified. And uploaded image will be broken.
Example: original image is highly compressed, 50% jpeg compression, takes 200 kb. After resizing with 100% new file will takes about 1 mb. But only first 200 kb of newly created file will be sent to server.
In addition, the following modification also would be useful for all who will venture to install the changes above: If Multiple Upload is enabled, don't show single file upload form to user.