Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
FR: Allow images to be resized on upload #1528
More robust handling of large, bad, and lots of images would be a real improvement.
Sanitising filenames was a big plus in protecting Statamic from clients uploading stuff, but large images is another weak point.
Resize on upload (which would be a cool feature) is not necessarily the catch-all for this. There are legitimate reason for having high res images so there needs to be some control. For example we have a site where the client wants to allow resellers to download high res images. The asset viewer needs to be able to handle these type of images without causing it to hang.
In order to resize the image we need the image in the first place, and therefore the memory needed to resize it.
I'll research this more, but do you guys know how others handle this? Client side resizing?
We could add a way for you to specify the max file size and prevent uploading in the first place.
So in 2.6.7, the memory issue should be solved, which is the root of this issue.
On your front-end, where you need the smaller version of the image, you can use those presets.
I prefer keeping the original images that are uploaded, as I agree with this comment from @lukeagsmith
If you're worried about a giant repo as per @anthubbard 's comment:
Then you can potentially gitignore your assets directory.
You may also get creative with an addon or two that could potentially use Glide to resize the image and replace the original one.
Hi Jason, this is perfect in terms of resizing but I think my point still stands - you sell Statamic with the value that you can VC your entire website - I'm a big big fan of the fact that I can restore a backup easily and perfectly per website within about 90 seconds from the last GIT commit. In the event of an emergency / issue, if I restore a backup from the GIT branch I don't want to have to chase down assets from the client with all the hassle of making sure I have the right image in the right folder etc etc. Not having to think about it at all is one of my favourite things about Statamic.
Is there a way you could add something simple in the yaml settings like:
When uploading - then we can choose to keep it or discard it if we want?
Hey this issue isn't with disk space which is cheap - it's with 2 problems:
Thanks for reopening.
If I could gitignore files over a certain size I could use that but it doesn't exist.