frm
Well-known member
My suggestion is to use ImageMagic or PHP GD, whichever is selected by the admin, to compress images to their choice (say 40% to 80%) as well as resize them to a maximum width (which will obviously resize their height to keep the same ratio too).
This will save some people enormous disk space and could also run retroactively for older photos uploaded (possibly on the cron).
In order to not be a resource hog, it would also queue up all photos as well as run a cron job to process X images not compressed every X minutes/hours (with admin able to execute it, like all other cron jobs, at non-peak hours to get ahead on compressing). This is so that someone couldn't upload 100 images and all resources would fly over to ImageMagic/GD to compress and resize. Rather, they'd upload at 100% and slowly, but surely, all compress.
Using this method wouldn't rely on a 3rd party API (such as Smush It) which could change at a moment's notice, keeping XF on their feet to maintain API calls, and be easier to maintain going forward with the development of XF.
This will save some people enormous disk space and could also run retroactively for older photos uploaded (possibly on the cron).
In order to not be a resource hog, it would also queue up all photos as well as run a cron job to process X images not compressed every X minutes/hours (with admin able to execute it, like all other cron jobs, at non-peak hours to get ahead on compressing). This is so that someone couldn't upload 100 images and all resources would fly over to ImageMagic/GD to compress and resize. Rather, they'd upload at 100% and slowly, but surely, all compress.
Using this method wouldn't rely on a 3rd party API (such as Smush It) which could change at a moment's notice, keeping XF on their feet to maintain API calls, and be easier to maintain going forward with the development of XF.
Upvote
29