Thumbnail

See all posts Reply

Thumbnail new!
by Steve, 18 years ago
I'd like to be able to check what is larger x value or y value of theimage then scale to a particular size based on determined sizes. Say it's
x=300
y=400

Then I'd like to scale x to 100

x=400
y=300

scale y to 100 and then crop to a 100x100 square.

Is it possible, and if yes, what are the steps?Reply
Re: Thumbnail new!
by Steve, 18 years ago
Ok, got it:

Needs something like this:

$info = getimagesize($handle->file_src_pathname);
$srcWidth  = $info[0];
$srcHeight = $info[1];
$widthMax  = 800;
$widthMax  = 800;
if ($srcWidth > $srcHeight) {
} elseif ($srcWidth < $srcHeight) {	
} else { // x=y	
}
Reply
Re: Thumbnail new!
by colin, 18 years ago
I am not too sure I understand what you mean. Maybe using image_ratio_crop would help. Maybe you can generate two thumbnails, and choose one or the other after the upload has taken place.Reply
Re: Thumbnail new!
by Steve, 18 years ago
image_ratio_crop is not in the documentation. Could you please explain what it does?Reply
Re: Thumbnail new!
by colin, 18 years ago
image_ratio_crop is available in the version 0.21 Release Candidate, that you can find here. More info here.

image_ratio_crop resizes an image, conserving the original sizes ratio, using image_x AND image_y as maximum sizes, and cropping excedent to fill the space.Reply