Forum Moderators: coopster
but I need the height to be always 200
the width does not matter but the max will be 200
this is what works but again I do not figure how change it to deliver that fixed height
$dest_x = $_POST['dest_x']; // echo"X $dest_x<br>";
$dest_y = $_POST['dest_y']; // echo"Y $dest_y";//$dest_x = 200;
//$dest_y = 200;if (imagesx($i) > $dest_x or imagesy($i) > $dest_y) {
//Is the width of the original bigger than the height?
if (imagesx($i) >= imagesy($i)) {
$thumb_x = $dest_x;
$thumb_y = imagesy($i)*($dest_x/imagesx($i));
} else {
$thumb_x = imagesx($i)*($dest_y/imagesy($i));
$thumb_y = $dest_y;
}
} else {
$thumb_x = imagesx($i);
$thumb_y = imagesy($i);
}$thumb = imagecreatetruecolor($thumb_x,$thumb_y);
imagecopyresampled($thumb, $i ,0, 0, 0, 0, $thumb_x, $thumb_y, imagesx($i), imagesy($i));
imagejpeg($thumb, "img/thumbs/t_$filename", 90);
img {
height: 200px;
width: auto;
}
Of course, this would apply to all images, so you may want to do a class:
img.height {
height: 200px;
width: auto;
}
Since I am not familiar with PHP, this is where my suggestion stops :)
Marshall