add_new_image Hard Crop Not Working
-
I added the following to functions.php:
add_theme_support( 'post-thumbnails' ); // for posts only, not pages set_post_thumbnail_size( 200, 200, true ); //200x200, hard-crop mode enabled add_image_size( 'tiny-thumb', 75, 75, true ); //sidbar thumbs, 50x50, no hard-crop
And then I want to reference the “tiny-thumb” image in a loop located in sidebar.php, which I’m referencing like so:
the_post_thumbnail('tiny-thumb');
Unfortunately, that outputs the following (actually, the image’s largest dimension, height or width, is set to 75, and the other value is relative to keep the aspect ratio):
<img width="75" height="75" title="my-image-title" alt="" class="attachment-tiny-thumb wp-post-image" src="https://example.com/path-to-original-image">
The problem is that the original image is shown, not the new hard-cropped 75×75 thumbnail that I want. Yes, I have rebuilt all thumbnails using the “Regenerate Thumbnails” plugin, and I have manually uploaded new files after making these changes without any luck. Additionally, I can change the dimensions in functions.php’s add_image_size() and the image’s height and width will change, but it’s still just the original image and is not being hard-cropped. What can I do?
- The topic ‘add_new_image Hard Crop Not Working’ is closed to new replies.