1

PHPThumb doesn't have very clear documentation of how to crop images. I HAVE been trying to crop some images to a ratio of 6.6 : 10 i.e I have images which are 1280 by 854, I don't want the height changed but I want the width reduced so that the ratio comes to 570:854 which is approx 6.6:10 . Then it will be resized normally to about 180:270 which maintains the 6.6:10 ratio.

Here's what I've tried, it hasn't been very successful. Its like the images don't even get cropped.

phpThumb.php?src=http://imagedomain.com/image.jpg&sx=0&sy=0&sw=570&sh=854&f=jpg&q=95&h=270&w=";

Could anybody point out what I'm doing wrong?

William The Dev
  • 505
  • 1
  • 6
  • 16

2 Answers2

0

I'm not familiar with PHPThumb, but if you want a really good tutorial which explains how everything works - http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/ I base my thumbnail generator code on this combined with: http://us.php.net/manual/en/function.imagecopyresampled.php#77679 + extra stuff to handle transparency.

jeremyj11
  • 589
  • 1
  • 5
  • 15
0

I use the class directly, not the URL call. On my windows dev box it couldn't find ImageMagick so it was using GD. I didn't care too much because it was only for dev and not for staging/live. The cropping worked perfectly.

When I deployed the app for staging and found cropping didn't work. I found that setting the following forced it to use GD, which got cropping to work:

$phpThumb->config_prefer_imagemagick = false;

Now I only set this when cropping, but leave all the other resizing at the default setting so that ImageMagick is used.

cornernote
  • 1,055
  • 1
  • 12
  • 20