decap-cms
decap-cms copied to clipboard
Save image in different formats in the media library
Is your feature request related to a problem? Please describe.
I am looking to have any number of image transformations in my git repo directly without having an account on a third-party system.
Describe the solution you'd like
In my admin/config.yml file it says:
media_folder: 'assets/uploads'
In the admin backend of my, when uploading, say, a 5Mb image called kittens.jpg to my media library, it goes to ./assets/uploads/kittens.jpg, then I can select it when adding it to a post.
Would it be possible to save the image in several sizes?
Describe alternatives you've considered
Could we have something like this in admin/config.yml?
media_folder: 'assets/uploads'
image_transformations:
- name: small
format: jpg
quality: 60
width: 100
- name: medium
width: 400
default: true
Then when I upload a 5 Mb "kittens" image, it would automatically create these files:
- ./assets/uploads/kittens.jpg
- ./assets/uploads/_transformations/small/kittens.jpg
- ./assets/uploads/_transformations/medium/kittens.jpg
And, then in my "embed image" widget, there could be an additional field "transformation" which would default to "medium", and that file would then be embedded into my post.
Additional context
Alhough Cloudinary and other services can be very useful, for very small projects these might be overkill. My experience with front-end content editors is that often they don't have an appreciation of the importance of keeping image size to a minimum, so automating that in part might be interesting.
Netlify CMS runs in the browser, so it can't handle that kind of process itself. What you can do is have your SSG take care of the image transformations for you when the site is being built.
If you're using Neltify you can of course take advantage of Netlify Large Media
Thanks! I appreciate the clarification; I will close this issue then.
We actually can do quite a bit of image processing in the browser, and resizing is pretty simple. I thought we had another issue for this but I'm not seeing one. Going to reopen as this should eventually be possible.
Has anyone worked on this? I may take a stab -- having browser-based resizing and compression built-in could be cool for those who solely using Netlify CMS and git-backed storage.
Go for it @mariolopjr we would love the contribution
Hi, is there any interest in landing this feature in the future. It would really make my workflow easier, as the way things are now forces me to resize images externally before uploading. This is fine as long as I am the only one using the interface, but it becomes a big problem when others have access and start uploading 4k images to the page.
It would really be great to resize images on upload.