How to Crop Image Thumbnail From Top Center – WordPress Tutorial
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.
Categories: Wordpress Tutorial