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? Link to comment https://forums.phpfreaks.com/topic/76402-transparent-gd-watermark/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/76402-transparent-gd-watermark/#findComment-386901 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, Link to comment https://forums.phpfreaks.com/topic/76402-transparent-gd-watermark/#findComment-386916 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 Link to comment https://forums.phpfreaks.com/topic/76402-transparent-gd-watermark/#findComment-386918 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? Link to comment https://forums.phpfreaks.com/topic/76402-transparent-gd-watermark/#findComment-386923 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.