Reduce Space for Generated Image Sizes
-
Hello there,
I have defined around 15 image size in my theme, after already reducing from about 25 sizes. You might try to tell me that I don’t need that many image sizes, but really, it makes sense to me to have them for Retina, non-Retina, mobile, extra large screens, different templates in my theme etc.
I want to reduce the disk space used by my images on the server. So I have been thinking of two approaches and got stuck with both of them:1. I delete the original file after uploading, I still have some very large but resized files and that’s enough. I managed to delete the original file after upload, but now the preview images in the “Insert Media” overlay (when adding media to a post) won’t show anymore because the original image files are used there. Now I tried saving a 140x140px sized copy of the image with the file name the original file had using WP Image Editor. But I didn’t manage to save or rename any file.
It would be way easier to just replace the image used for the preview in the “Insert Media” thing using a hook/filter. But I couldn’t find anything on that yet…2. This solution would make more sense and save more space, but I think it’s a bit more complicated. I have three post types in my theme and they all use different image sizes. However, the majority of my images I only need in one post type’s image sizes. So is there a way to define that an image uploaded to a post of post type “portfolio” will only be resized to the image sizes “portfolio-big”, “portfolio-middle” and “portfolio-small”? Or else, maybe, only resize images whenever they are requested for the first time?
The whole media topic is a big and difficult one to me. I’m sure many people have fought the same or similar issues as I am fighting now, however it’s been quite hard to find anything useful to me.
Any help appreciated!
- The topic ‘Reduce Space for Generated Image Sizes’ is closed to new replies.