How to Crop Image Thumbnail From Top Center – WordPress Tutorial

by WebMinimalist.com on Oct 10, 2012
in Wordpress Tutorial1 Comment


I’ve been searching about how to crop image thumbnail from the top center (instead of default center center), but unfortunately the only thing to solve this problem is by editing the core.

Open wp-includes – media.php. Find this lines:

$s_x = floor( ($orig_w - $crop_w) / 2 );
$s_y = floor( ($orig_h - $crop_h) / 2 );

And replace with this code:

$s_x = floor( ($orig_w - $crop_w) / 2 );
$s_y = 0; //floor( ($orig_h - $crop_h) / 2 );

And then you need to regenerate your thumbnails using plugins, Regenerate Thumbnails. This step will automatically crop all the post thumbnails again.

One Response to “How to Crop Image Thumbnail From Top Center – WordPress Tutorial”

  1. Nice Tips. I have a WordPress Blog. I’ll Use Your Code for Image Setting. Thank you very much for Sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>