I just started to optimize the auto-scaling of images i upload on my wordpress (via Media tool). I added the desired set of custom sizes, which are working just fine. In example :
add_image_size( 'og', 400, 9999 );
add_image_size( 'xxl', 300, 9999 );
add_image_size( 'xl', 100, 9999 );
add_image_size( 'l', 10, 9999 );
and so on...
But now i’m wondering if there is a way to put a condition to add_image_size() ? Is it possible to use a set of add_image size only if the uploaded image is equql to or less than 150px ?
I have very small img files (icons, logo) who needs small custom sizes and medium/wide one that need big custom sizes, so i’m trying to avoid the creation of very small versions of images that are destined to be big. As wordpress don't scale images up, the idea is to have a rule that does something like : if the file i'm uploading has a width <= 150px then use this additional set of add_image_size().
I’m a beginner in coding so this might not be the right way to do it and i’m open to any suggestion !
Thank you