PDA

View Full Version : can you help me in this code please ?



fuchsia555
14 Dec 2009, 03:37 PM
Hi
i have image script , and images have my own watermark on the bottom , size of this watermark 15 pixel ,,, i just need help in the code below to tell php to ignore reading this watermark while creating thumbnails for the images , i just want the watermark disappear in thumbnails only


here the code i think it relevant to the issue and i will provide the link of the script if i have asked for


here that in uploud.php


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

#Accomodate image options
if(isset($_REQUEST['border']) || isset($_POST['border']))
gd_rectangle($image,0,0,gd_width($image)-1,gd_height($image)-1,"000000");
if(isset($_REQUEST['bordert']) || isset($_POST['bordert']))
gd_rectangle($thumb,0,0,gd_width($thumb)-1,gd_height($thumb)-1,"000000");


#save thmb first
imagejpeg($thumb,"$th/$id.jpg",$settings['thumbuality']);
imagedestroy($thumb);
#then save actual jpeg
imagejpeg($image,"$im/$id.jpg",$settings['quality']);
imagedestroy($image);

$iptc = new iptc("$im/$id.jpg");
if($cimg[0] == 1) {
#it is gif keep in data
write_file("$im/$id.jpg",load_file("$th/$id.jpg"));
write_file("$im/$id.gif",$cimg[1]);
$iptc->set(DPI_GIF,"GIF");
}


functions that in dpi_ext.php (and i think it's relevant with the issue





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);

}
function gd_getfit(&$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 Array('width'=>$width,'height'=>$height);

}

function gd_width(&$image) {
return imagesx($image);
}
function gd_height(&$image) {
return imagesy($image);
}

function gd_imagewidth($fname) {
list($width, $height) = getimagesize($fname);
return $width;
}
function gd_imageheight($fname) {
list($width, $height) = getimagesize($fname);
return $height;
}

function gd_fit_bg(&$img,$fit=100,$color="FFFFFF") {
$w = imageSX($img);
$h = imageSY($img);
$img2 = gd_newimage($fit,$fit);
gd_bar($img2,0,0,$fit,$fit,$color);

$x = ($fit-$w)/2;
$y = ($fit-$h)/2;

imagecopy($img2, $img, $x,$y, 0, 0, $w, $h);
return $img2;
}

function gd_resize(&$image,$w,$h) {
$ret=@imagecreatetruecolor($w, $h);
@imagecopyresampled ($ret,$image, 0, 0, 0, 0, $w, $h, imagesx($image), imagesy($image));

return $ret;
}