Change default crop origin of a featured image in Wordpress (thumbnail)

6.3k views Asked by At

I would like to change the way Wordpress crops the featured images thumbnail. The generated thumbnails are cropped from the center. Can I control that to set up to top left ? This post mentions a plugin, but it doesen't really exists :3 And the Scissors plugin seams not to affect featured image thumbnail.

Any idea ?

3

There are 3 answers

1
PoseLab On BEST ANSWER

It is not good idea to modify the core of Wordpress. You can use the plugin Thumbnail Crop Position to select a corner or the center point of the image from where the image will be cropped.

1
1213 On

In wp-includes/media.php, line 360, I found :

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

...and changed to :

    $s_x = 0;
    $s_y = 0;

... to define crop to top right.

0
wp-mario.ru On
update_option( 'thumbnail_crop', array( 'left', 'top' ) );

Values can be: left, center, right