cooldude832 Posted November 7, 2007 Share Posted November 7, 2007 Any one know what would be the best way to accomplish a transparent watermark on upload with GD that will work for Jpegs, Gifs and Pngs, using only GD in php 4? Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 7, 2007 Share Posted November 7, 2007 Heres the best and easy way i usually use You are pretty good with php i believe so all you will have to do is on upload have that image's path name go to here $image = imagecreatefromjpeg(uploadedfile); and $size = getimagesize(uploadedfile); then output the image. with the watermark which is watermark.png '<?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('watermark.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg($_GET['src']); $size = getimagesize($_GET['src']); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 7, 2007 Share Posted November 7, 2007 If u need help integrating it post up your code and ill help you out, Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 7, 2007 Author Share Posted November 7, 2007 na, I see what your doing, that wasn't my issue my concern is dealing with file types and the legacy issue of transparent layers in images Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 7, 2007 Share Posted November 7, 2007 Oh ok so you mean what if a different type of image is uploaded other than a jpeg? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.