Stop Cropping My Featured Images

Posted · Add Comment

Do your Landscape Thumbs (the ones in your blog loop) get cutoff in annoying ways sometimes? Mine do. Let’s fix that.

First, a funny example:

Before (default hard crop)

Funny crop example - before

After (changed to no crop)

Funny crop example - after

Ok, now to the fix..

If I would have thought of it before, I should have included this code in a previous post — Access or Remove the PageLines Custom Image Sizes — which would have then been called “Access, Override, or Remove …”

Option 1 (easy code — but try Option 2 first)

Well, this code just overrides the PL DMS custom image sizes because it uses the same names (e.g. ‘basic-thumb’). I chose to leave the sizes the same and simply change the “hard crop” argument to be ‘false’ instead of ‘true’.

Add the Code

So, add this code to your child theme’s functions.php (or the Customize plugin or create your own “functionality plugin”):

Regenerate All Thumbnails

After that code’s in place, install a plugin to regenerate past thumbnails, like Regenerate Thumbnails. Then bulk resize all images (will take a long time if you have a lot of images) or just resize the few that are a thorn in your side.

Option 2 (no code — even easier)

An equally easy option (code free! — some people prefer that) is to install the Simple Image Sizes plugin.

Once activated, change the thumbnail options to your liking at Settings -> Media, like this:

PL thumbnails defaults - Simple Image Sizes

PL thumbnails defaults – Simple Image Sizes

PL thumbnails customized via Simple Image Sizes

PL thumbnails customized via Simple Image Sizes

Then use the plugin to regenerate new thumbnails that are no longer hard cropped (further down the page at Settings -> Media). I’d recommend only regenerating the image types that you changed, like this:

Simple Image Sizes selective regenerating

Simple Image Sizes selective regenerating

You Can’t Lose

No matter how you regenerate thumbnails, whether for one or in bulk, new files will be created (e.g. bigimage-900x352.png), but the pre-existing images will not be deleted (e.g. bigimage-900x450.png) from your server.

All future uploads (i.e. new files) will ONLY have the then-current thumbnail sizes generated.

Comments are closed.