ACF and Skipping Image Sizes
-
I am running into an issue where some image sizes are being skipped/ignored as I resize my browser window. I am using ACF and have implemented the code mentioned in your Git page.
Functions.js
/************* PICTUREFILL (MP) *****************/ add_filter('acf/format_value_for_api', 'theme_function_picturefill_for_acf', 11, 3); function theme_function_picturefill_for_acf($content, $post_id, $field){ if(in_array($field['type'], array('textarea', 'wysiwyg', text))){ return Picturefill_WP::get_instance()->cache_picturefill_output($content, $field['name']); }else{ return $content; } } add_filter('theme_acf_image', 'theme_function_for_acf_image', 10, 2); function theme_function_for_acf_image($content, $name_of_the_image_field){ return Picturefill_WP::get_instance()->cache_picturefill_output($content, $name_of_the_image_field); } add_filter('picturefill_wp_media_query_breakpoint', 'remove_picturefill_wp_breakpoint_buffer', 10, 3); function remove_picturefill_wp_breakpoint_buffer($breakpoint, $image_size, $width){ if('thumbnail' !== $image_size){ return $width; }else{ return $breakpoint; } }
Home.html:
<?php $image_object = get_field('band_1_image'); $image_output = '<img src="' . $image_object['sizes']['large'] . '" title="' . $image_object['title'] . '" alt="' . $image_object['alt'] . '" />'; echo apply_filters('theme_acf_image', $image_output, 'name_of_the_image_field'); ?>
And finally, this in acf.php
add_filter('acf/format_value_for_api', 'theme_function_picturefill_for_acf', 11, 3); function theme_function_picturefill_for_acf($content, $post_id, $field){ if(in_array($field['type'], array('textarea', 'wysiwyg', text))){ return Picturefill_WP::get_instance()->cache_picturefill_output($content, $field['name']); }else{ return $content; } }
Here’s a direct link to the odd behavior.
Basically, the middle-ish image sizes never come into play. We skip from largest to the smallest. Strangely, a quick look at the inspector does indicate that the mid-size images are being loaded and definitely exist.
My Media settings are:
Thumb: 319 x 319
Medium: 930 x 1024
Large: 1024 x 1024My template is set to load the ‘large’ IMG, instead of ‘medium’, by default.
Thoughts? (Thank you, in advance.)
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘ACF and Skipping Image Sizes’ is closed to new replies.