We began work on the portal after we started consulting with the WhiteMad editorial team. The problem with the portal reported from the hosting informed about too much space taken up by the Wordpress template graphic files.
An additional problem was the 15zine template because each photo that was uploaded to Wordpress Media generated more than 20 different formats not used on the portal.
We started by checking the image sizes used in the template. It turned out that we have more than 15 additional (in addition to the default ones from Wordpress) sizes, including several larger ones (above 1024px).
Images in these larger sizes often weighed about 300-500kB each, which, with more than 100,000 uploaded images, added up to more than 50GB of files.
The first idea was to disable unused image sizes, but after reviewing the site, it turned out that virtually every one of them is used in various places on the site (mainly the article grid). Realistically, it was possible to disable maybe 3-4 sizes, which wouldn't be of much benefit.
See the service Wordpress care and optimization of Wordpress sites.
We decided to take a different approach - using the "Fly Dynamic Image Resizer" plugin, it is possible to disable Wordpress' generation of alternative image sizes when uploading images to the media library.
Instead, images are generated only when they are needed on the front end. In our case, such an action will significantly reduce the FTP disk usage, since all the image sizes used in the article grids apply only to the image of the main post, and not to the images from its content. Thus, in total, only about 10% of all images will have alternative sizes generated, and the remaining 90% will appear only in a few default versions.
However, just enabling the plugin is not enough, as it does not replace the default operation of the Wordpress size generator. The plugin expects to use "fly_add_image_size()" instead of the default "add_image_size()" when registering sizes in the template, and to use "fly_get_attachment_image()" and "fly_get_attachment_image_src()" instead of "wp_get_attachment_image()" and "fly_get_attachment_image_src()" respectively when displaying images.
The web portal we worked on used a pre-made Wordpress 15zine template, so there was no way to swap these functions directly in the template code. Instead, it was necessary to manually remove the pre-recorded sizes using ""remove_image_size()"", and then plug in the "wp_get_attachment_image" filter and swap the logic of this function to automatically retrieve images using "fly_get_attachment_image()".
After the whole operation, all previously generated image sizes still had to be deleted to free up FTP space.
The only disadvantage of using the "Fly Dynamic Image Resizer" plugin is that for the first person visiting the site after adding new photos, there will be a slightly increased loading time (the necessary photo sizes must be generated before displaying). With the traditional solution, this operation is already performed by the administrator when uploading new photos to the media library.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.