Description
When adding images through Magento API, Magento pregenerates all defined downscaled versions for that image. While pregenerating downscaled versions is a good thing, it looks like Magento's default theme defines a LOT of differing image sizes.
Image sizes are defined here: https://github.com/magento/magento2/blob/develop/app/design/frontend/Magento/blank/etc/view.xml
Example of almost same size definitions:
<image id="recently_viewed_products_images_only_widget" type="small_image">
<width>76</width>
<height>76</height>
</image>
<image id="gift_messages_checkout_small_image" type="small_image">
<width>75</width>
<height>75</height>
</image>
<image id="mini_cart_product_thumbnail" type="thumbnail">
<width>78</width>
<height>78</height>
</image>
Surely there is no proper reason to generate almost equal downscaled versions of the same image? I would expect Magento to maintain maximum of 3-5 downscaled versions.
Preconditions
- Latest Magento CE installed
Steps to reproduce
- Add lot of images through API
- Observe sizes of media folders catalog/product and catalog/product/cache
Expected result
- Cache folder size is reasonable compared to size of originals
Actual result
- Depending on amount of images. Example in my case:
- catalog/product 64G
- catalog/product/cache 51G
Which means originals take 13G, and cached versions take 51G of disk space. There appears to be total of 34 generated versions of one image:
./0/image/400x400/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/image/700x560/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/image/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/image/700x700/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/image/285x285/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/image/265x265/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/swatch_image/30x20/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/swatch_thumb/110x90/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/165x165/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/76x76/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/270x340/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/75x90/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/152x190/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/113x113/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/240x300/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/75x75/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/270x270/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/100x100/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/140x140/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/270x207/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/135x135/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/78x78/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/285x285/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/small_image/110x160/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/152x188/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/76x76/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/200x248/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/75x90/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/75x75/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/100x100/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/88x110/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/140x140/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/78x78/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
./0/thumbnail/90x90/beff4985b56e3afdbeabfc89641a4582/1/4/1426281_3.jpg
Note that eg. 75x75 pixels sized version is generated multiple times, for thumbnail and for small_image. Actual file content is 1:1 identical.