admin管理员组文章数量:1394192
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', 200, 9999 );
add_image_size( 'l', 250, 9999 );
add_image_size( 'm', 150, 9999 );
add_image_size( 's', 100, 9999 );
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 less than 150px ?
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
本文标签: functionsCan you put a condition on addimagesize() depending on the width of the uploaded image
版权声明:本文标题:functions - Can you put a condition on add_image_size() depending on the width of the uploaded image? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744772481a2624423.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论