0

I'm using this code:

set_post_thumbnail_size(726, 200, true);

My objective is to input any size image and let WP crop it and resize it to 726x200.

I got it working ONE time, just once.
Now it doesn't work anymore. I tried 5 different servers. I tried localhost with xampp and wamp. Nothing!

The image resizes fine but it doesn't get cropped as it should.

I've been looking for answers for the past 5 hours with no luck.
GD is loaded in PHP. I tried different httpd.conf and php.ini tricks and nothing works. I tried removing the image from the gallery and adding it again as some people suggest and still nothing.

I'm desperate!

Is this a bug?

An image so you can see what's wrong. The image is being resized only but it should be cropped and it should span to the end of the container. bad http://tinypic.com/images/404.gif good

9
  • Where are you doing this? Which file?
    – Pekka
    Sep 9, 2011 at 9:22
  • functions.php just after add_theme_support( 'post-thumbnails' )
    – elclanrs
    Sep 9, 2011 at 9:24
  • Not sure I understand: How would I crop that image so it spans to the end of the container? I don't think that is how the thumbnail mechanism works.
    – Pekka
    Sep 9, 2011 at 9:38
  • I put a couple images explaining what's wrong. I got it working ONCE but it doesn't work anymore and I don't know why. I'm using the same exact code. I tried many different images and nothing. The code should do what you see on the second image.
    – elclanrs
    Sep 9, 2011 at 9:42
  • 1
    OMG, I got it working again. I found the culprit! Yessss! It turns out that I was passing a variable instead of an actual value like this set_post_thumbnail_size($variable, 200, true), but if I pass the actual value like this set_post_thumbnail_size(726, 200, true) IT WORKS! Can't believe I just wasted 5 hours...
    – elclanrs
    Sep 9, 2011 at 9:59

1 Answer 1

0

OMG, I got it working again. I found the culprit! Yessss! It turns out that I was passing a variable instead of an actual value like this set_post_thumbnail_size($variable, 200, true), but if I pass the actual value like this set_post_thumbnail_size(726, 200, true) IT WORKS! Can't believe I just wasted 5 hours...

Your Answer

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

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