[resolved] add_image_size - hard crop doesn't work (2 posts)

  1. WorldWideWebb
    Posted 3 years ago #

    I know others have posted about this, but the hard crop in add_image_size still doesn't appear to work. It appears that the image is being resized before it's cropped (which doesn't say "hard-crop" to me). I have confirmed that GD is installed on the server, that thumbnails have been enabled for my theme (and under the appropriate hook), plus the fact that I'm uploading images and all of the thumbnail sizes are being generated.

    Does anyone have a workaround for this (especially one that doesn't involve modifying the core)?


  2. WorldWideWebb
    Posted 3 years ago #

    Found a solution!

    I did some more searching and came across this great snippet:


    I then modified the bt_image_resize_dimensions function so that it will either always use WordPress's version of "hard-crop" (meaning it will resize the image down first, then crop the remaining), or it will actually hard-crop the image (meaning it will crop down, to the specified dimensions, using the full-size image). The new function in its entirety can be found here:


Topic Closed

This topic has been closed to new replies.

About this Topic