Thumbnail Cropping from top left instead of middle center (7 posts)

  1. nealreal
    Posted 6 years ago #

    I would like the thumbnail cropping feature to crop from top to left instead of center center. I love the new post-thumbnail feature and the cropping feature, but I wonder if it is, at all possible, to change the way WP is cropping my thumbnails.

  2. nealreal
    Posted 6 years ago #

    I found the solution! I'm using WP 2.9.1
    Go to your includes > media.php file.
    Line: 309 and 310

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

    Replace the above with:

    $s_x = 0;
    $s_y = 0;

    This will make WP crop from top to left.
    I would keep the old code commented above it just for reference.

  3. nealreal
    Posted 6 years ago #

    Once you've made changes, the easiest way to redo all your old thumbnails with the new settings is to install this plug-in:
    Regenerate Thumbnails
    this will regenerate all your plug-ins.
    You may also want to hit "refresh" a couple of times to see the newly cropped thumbnails.

  4. nealreal
    Posted 6 years ago #

    This works for WP 2.9.2 as well.

  5. rosacreative
    Posted 6 years ago #

    That's a workaround but ideally WordPress should allow the user control over the crop position of every image.

    Is this something that will come in WordPress 3? I hope so..This is really frustrating especially for a portfolio site where you want to showcase the best part of the image in the thumbnail.

  6. kingofpunk
    Posted 6 years ago #

    I second rosacreative, because most of the time the important visual information of an image is on the top center part.

  7. cramdesign
    Posted 5 years ago #

    is there a way to do this other than editing the core?

Topic Closed

This topic has been closed to new replies.

About this Topic