PDA

View Full Version : how can we minus 15 pixel from fitting image in this code ?



fuchsia555
13 Dec 2009, 02:26 PM
how can we minus 15 pixel from bottom height in fitting to create thumbnails for original image in this code ? i mean how can tell php that capture from original image the ( all width ) and ( all height minus -15 pixel from bottom )



#create thumb
$thumb = gd_fit($image,$settings['thumbxy']);




function gd_fit(&$image, $target) {

//takes the larger size of the width and height and applies the
//formula accordingly...this is so this script will work
//dynamically with any size image

$width = gd_width($image);
$height = gd_height($image);

if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height);
}

//gets the new value and applies the percentage, then rounds the value
$width = round($width * $percentage);
$height = round($height * $percentage);

//returns the new sizes in html image tag format...this is so you
//can plug this function inside an image tag and just get the

return gd_resize($image,$width,$height);

}