many add_image_size increasing TTFB massively
-
Hi guys,
I’m working on a wordpress theme, where im generating a lot of different image sizes, based on the needed sizes, so “add_image_size” is called 140 times. https://pastebin.com/fECdFnfA – that’s a list of all of my image sizes.
I wrote a plugin that generates everything for me – but it seems like that calling “add_image_size” is really slowing down wordpress. and now im searching for an alternate approach to this.https://pastebin.com/U8Uty3gu – that’s the script i wrote.
This class generates all this sizes with different crops and everything. I know it is not the best solution but it delivers the right images, with different breakpoints and everything
i just call –
<?php echo Interchanger::getInterchangeTemplate(get_sub_field('icon'), 'small-fourth-none, medium-fourth-none, large-fourth-none, xlarge-fourth-none', 2); ?>
this returns me a string formated to use in Zurb foundations Interchange.
first argument is an image object, second argument is a string with media reakpoints, separated by a comma. Then the arguments are : screensize-ration-crop
but this can’t be the right solution for wordpress, right? Is there a better way in wordpress to handle crops and responsive images alltogether?
Any help is really appreciated – thank you!
- The topic ‘many add_image_size increasing TTFB massively’ is closed to new replies.