Quantcast
Viewing all articles
Browse latest Browse all 134430

rkoller on "Possible to conditionally run different sets of add_image_size?"

At the moment I am trying to get the following Picturefill solution for WP going:

http://premium.wpmudev.org/blog/diy-truly-responsive-images-on-your-wordpress-website/

Problem is - in the described solution you only have a single set of image versions. The ones in settings-media alongside the ones you additionally define in functions.php

add_image_size('resp-large', 720, 9999);
add_image_size('resp-medium', 520, 9999);
add_image_size('resp-small', 320, 9999);

So each uploaded picture gets converted to the predefined values. Problem is that those few breakpoints wouldn't cover my needs - I have a few obscure aspect ratios to cover as well.

So I've wondered if there are options in WordPress to insert some sort of conditionals wrapping the add_image_size routine. Like if the image has a certain caption then create images for the breakpoint set 1 and with another create images for the breakpoint set 2. Would have the advantage that there wouldn't be tenth of images but only a fraction - the ones necessary for the layout of that specific picture.

But I am uncertain what would be a reliable hook to distinguish to what group / breakpoint set an images belongs (via captions or class names) and if it would be basically possible to select between breakpoint sets, each with different add_image_size settings (by a simple if statement - is every add_image_size statement created anyway)?

Best regards Ralf


Viewing all articles
Browse latest Browse all 134430

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>