4

I've set up a bunch of additional image sizes in my functions.php theme file, with the crop parameter set to true. However, the images are resized but not cropped.

    if (function_exists('add_image_size')) {
        add_image_size('frontpage_a-la-une_thumb', 400, 215, true);
        add_image_size('single_thumb', 320, 9999, false);
        add_image_size('category_a-la-une_thumb', 280, 215, true);

        add_image_size('xxs-square-thumb', 60, 60, true);
        add_image_size('xs-square-thumb', 70, 70, true);
        add_image_size('s-square-thumb', 98, 98, true);
        add_image_size('square-thumb', 130, 130, true);
        add_image_size('l-square-thumb', 198, 198, true);

        add_image_size('landscape-thumb', 150, 98, true);
        add_image_size('portrait-thumb', 98, 145, true);
    }

The GD library is installed, so is imageMagick, but no dice.

What am i missing?

UPDATE: Problem arises with images that are smaller than the set image size: i was expecting WP to create image versions by scaling them up, but it doesn't. So, my bad, sorry for getting that point wrong.

2
  • 1
    Could you add specific example with actual numbers? Like "I upload image of these dimensions and expect such size to be that, but instead it's...". There is quite a few lines of math going on to calculate resize and there are kinks in it that are much easier to catch when dealing with real numbers.
    – Rarst
    Commented Nov 1, 2011 at 12:24
  • You're right: i did some tests carefully noting down image sizes and verifying what was done. Wrong ok for large images, doesn't work for images smaller than the set size, and my assumption is wrong. See Question update.
    – pixeline
    Commented Nov 3, 2011 at 10:24

2 Answers 2

4

Currently, WordPress core image handling/thumbnail creation does not perform zoom-crop. If you need an intermediate image size to be created explicitly, you will need to ensure that you upload an image with equal or larger dimensions as the intermediate image size.

1
  • zoom-cropping. That's exactly the term describing what i was looking for. I'll look into an existing plugin, or possibly develop one that does that.
    – pixeline
    Commented Nov 4, 2011 at 13:47
3

You'll need to regenerate the thumbnails for existing images. I use this plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/

If your new images aren't being cropped correctly then you have another issue.

1
  • i already use that plugin. It's another issue, probably related to the server configuration. But what exactly...
    – pixeline
    Commented Nov 1, 2011 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.