No matter what I do – I can’t get the hard cropping mode in the_post_thumbnail to work.
Here’s what I have:
add_image_size( 'Blog', 300, 300, true );
the_post_thumbnail('Blog');
I’ve also tried:
set_post_thumbnail_size( 300, 300, true );
the_post_thumbnail();
I’ve tried uploading new images, and using the “Regenerate Thumbnails” plugin, but still no luck. It completely ignores the “true”, and acts as if it’s “false”. For example, instead of the image being 300×300, it’ll be 300×238 or something.
Has anyone else experienced this? My GD Library is enabled..
Thanks for any input anyone can offer =)
A lot of the time the reason it isn’t working because you haven’t regenerated the thumbnails for all your images.
If you have changed the dimensions of your images you will need to regenerate your thumbnails using this plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/
I would say that you might not have the GD libraries installed on your server. Without this, you will only get the file uploads and no image crops.
First, do a sanity check by calling
phpinfo()
to see if GD is installed.GD Installation on Linux
If you have shell access, simply type this command:
You’ll need to restart the server after installing GD
Here’s the command to reboot Apache:
Shared Hosting
If you’re on a shared box, you’ll need to contact your host and have them install it on your server.
One Last Thing
Does your theme have thumbnail support?
I’ve actually finally fixed this issue.
It seems that the hard-cropping works if you set the image size inside a function that is hooked into the “after_setup_theme” hook.
So, the below would work:
This will allow you to get actual hard cropped images using the sizes specified using the_post_thumbnail().
Hope this helps someone else as well.
Instead of defining the post thumbnail size as blog why not just set the post thumbnail explicitly in the template where you want it to show up…
I’ve just had this same issue and the answer for me was regenerating thumbnails as bryceadams suggested (I don’t have enough points to vote for his response unfortunately).
Caveat: The images must be stored locally not remotely. Presumably no thumbnails are generated for remote images.
In my case, this issue was caused by filer permissions on the images. I had copied the images from one server to another, forgetting to change the ownership. When new image sizes were set, and I regenerated them, the old images weren’t overwritten as they should have been.
To fix this I connected to my server with SSH, navigated to
the wp-content/uploads
folder and reset the ownership of all the images there. e.g.Hope that helps someone.
You’ll never have a hard-cropped image other than the default sizes.
You’ll not get this answer in WP forums, or if you do, they’ll show you a carrot for weeks until you get anxious and get blocked or they fixed it silently.
The hard-cropped images are only for
Things that are not possible are NEVER shown in the front end or tried to be covered up in forums as much as possible (our free .org project is their .com product) even if the above options got you pulling your hair for months.
The second option should read “ALL OTHER SIZES EXCEPT YOURS”
I’m developing a plugin for that, and an extra magic. I’ll get it done soon, but I’ll need some help to publish it in the plugins library since I’ve been banned! hehe (for helping others with un-reported (or ignored) bugs)
I had the same issue and installed a plugin that allows to regenerate one/some/all of your images. This is the plugin: [http://wordpress.org/plugins/regenerate-thumbnails/]
I did not find the way of doing it from the WP admin UI except if you delete and upload the image again.
Another way of doing it, if you do not want to use a plugin, would be to do it with PHP functions
where $thumbnail_id and $absolute_path_to_image have to be set with the values you want.
Thanks to @briceadams and @adriaticiq. I cannot yet vote you but I will as soon as I am allowed.