add_image_size problem
-
It appears that lots of people are having an issue with the crop feature of add_image_size. I have tried to diagnose my issue to no avail.
I do have GD libraries installed, verified by phpinfo.
From my functions.php:
if ( function_exists( 'add_image_size' ) ) { add_image_size( 'featured-mobile', 767, 900 ); add_image_size( 'featured-full', 1170, 500 ); // }
Original image is 2240 x 1867, so this would be a soft crop to 1170×500.
From my page.php:
<div class="featured-image-mobile visible-xs"> <?php if ( has_post_thumbnail()) { the_post_thumbnail('featured-mobile'); } else { echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/featured-default.jpg" />'; } ?> </div><!--/.featured-image-mobile--> <div class="featured-image hidden-xs"> <?php if ( has_post_thumbnail()) { the_post_thumbnail('featured-full'); } else { echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/featured-default.jpg" />'; } ?> </div><!--/.featured-image-->
Here’s what I’ve tried:
Regenerating Thumbnails
Ensuring GD Library is installed on serverHere is an imgur of what I’m seeing: https://imgur.com/Ktcp31y
It should be full width 1170 soft crop to 500. Instead it is 599 x 500 (max height, no crop).
What am I doing wrong here?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘add_image_size problem’ is closed to new replies.