WorldDrknss Posted January 28, 2008 Share Posted January 28, 2008 I searched through the forums but the one thread referring to what I need did not receive any replies. What I want to do is scale a watermark to about 1/4 of the original image size. This is because when an image is smaller then the watermark the watermark is the full width and height of the original image. this is what I am currently using to test but will change once I figure out how to scale the watermark. $imagesource = $_GET['path']; $filetype = substr($imagesource,strlen($imagesource)-4,4); $filetype = strtolower($filetype); if($filetype == ".gif") $image = @imagecreatefromgif($imagesource); if($filetype == ".jpg") $image = @imagecreatefromjpeg($imagesource); if($filetype == ".png") $image = @imagecreatefrompng($imagesource); if (!$image) die(); $watermark = @imagecreatefromjpeg('index_02.jpg'); $imagewidth = imagesx($image); $imageheight = imagesy($image); $watermarkwidth = imagesx($watermark) ; $watermarkheight = imagesy($watermark) ; $startwidth = (($imagewidth - $watermarkwidth)); $startheight = (($imageheight - $watermarkheight)); imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth , $watermarkheight); header("Content-type: image/jpeg"); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); Link to comment https://forums.phpfreaks.com/topic/88150-solved-watermark/ Share on other sites More sharing options...
WorldDrknss Posted January 28, 2008 Author Share Posted January 28, 2008 Bump. Please I need this. Link to comment https://forums.phpfreaks.com/topic/88150-solved-watermark/#findComment-451513 Share on other sites More sharing options...
WorldDrknss Posted January 28, 2008 Author Share Posted January 28, 2008 I figured it out. Link to comment https://forums.phpfreaks.com/topic/88150-solved-watermark/#findComment-451619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.