Problem with ratio crop

See all posts Reply

Problem with ratio crop new!
by Ferdia, 13 years, 5 months ago
Hi, I am having a problem with the ratio crop function, here is my code:
$path = '../photos/small/';
$obj = new upload($_FILES['image']);
if($obj->uploaded) {
  $time = time();
  $obj->file_new_name_body    = $newid."-".$time;
  $obj->jpeg_quality		   = 100;
  $foo->image_resize          = true;
  $foo->image_ratio_crop      = true;
  $foo->image_y               = 75;
  $foo->image_x               = 75;
  $obj->process($path);
  if ($obj->processed){
    $imageOriginal = $obj->file_dst_name;
    $size = getimagesize($path . $imageOriginal);
    $imageOriginalWidth = $size[0];
    $imageOriginalHeight = $size[1];
}

It returns the image at its original size. Any suggestions?Reply
Re: Problem with ratio crop new!
by colin, 13 years, 5 months ago
Can you copy and paste the log produced by the class?

Besides, for the three last lines of your code, you can use instead:
$imageOriginalWidth = $obj->image_dst_x;
$imageOriginalHeight = $obj->image_dst_y;
Reply
Re: Problem with ratio crop new!
by Ferdia, 13 years, 5 months ago
This is the output, I also swapped out the lines you recommended:

system information
- class version : 0.30
- operating system : Linux
- PHP version : 5.2.9
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : /php/includes/:/usr/local/pem/vhosts/134438
- upload_max_filesize : 16M (16777216 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME type detected as image/jpeg by UNIX file() command
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : Deerfire_high_res.jpg
file_src_name_body : Deerfire_high_res
file_src_name_ext : jpg
file_src_pathname : /usr/local/pem/vhosts/134438/tmp/phpBg6bd4
file_src_mime : image/jpeg
file_src_size : 1167592 (max= 16777216)
file_src_error : 0
- source file is an image
image_src_x : 1731
image_src_y : 1069
image_src_pixels : 1850439
image_src_type : jpg
image_src_bits : 8
process file to ../photos/small/
- file size OK
- file mime OK : image/jpeg
- new file name body : 9-1290977425
- file name safe format
- destination variables
file_dst_path : ../photos/small/
file_dst_name_body : 9_1290977425
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : 9_1290977425.jpg
file_dst_pathname : ../photos/small/9_1290977425.jpg
- 9_1290977425.jpg doesn't exist already
- no image processing wanted
- process OKReply
Re: Problem with ratio crop new!
by colin, 13 years, 5 months ago
Well, in fact, in your code, you use $foo and $obj!Reply