graham23s Posted September 19, 2013 Share Posted September 19, 2013 Hi Guys, When i upload and merge my watermark .png on to my images it still shows the square border rather than just the logo, the square borders should be invisible. My watermark code: // DEFINITIONS... define('WATERMARK_OVERLAY_IMAGE', '../img/img-wmLogo.png'); define('WATERMARK_OVERLAY_OPACITY', 100); define('WATERMARK_OUTPUT_QUALITY', 100); Function code: function create_watermark($source_file_path, $output_file_path) { list($source_width, $source_height, $source_type) = getimagesize($source_file_path); if ($source_type === NULL) { return false; } switch ($source_type) { case IMAGETYPE_GIF: $source_gd_image = imagecreatefromgif($source_file_path); break; case IMAGETYPE_JPEG: $source_gd_image = imagecreatefromjpeg($source_file_path); break; case IMAGETYPE_PNG: $source_gd_image = imagecreatefrompng($source_file_path); break; default: return false; } $overlay_gd_image = imagecreatefrompng(WATERMARK_OVERLAY_IMAGE); $overlay_width = imagesx($overlay_gd_image); $overlay_height = imagesy($overlay_gd_image); imagecopymerge($source_gd_image,$overlay_gd_image,$source_width - $overlay_width,$source_height - $overlay_height,0,0,$overlay_width,$overlay_height,WATERMARK_OVERLAY_OPACITY); imagejpeg($source_gd_image, $output_file_path, WATERMARK_OUTPUT_QUALITY); imagedestroy($source_gd_image); imagedestroy($overlay_gd_image); } It appears like: http://www.camnev-electronics.com/wwwwwwwwwwwwwwwwwwwwwwwww-2743.html and http://www.camnev-electronics.com/test-2739.html I know nothing about photoshop but my designer has swore blue the background is transparant, is this a coding problem would you say? i can't think of what else to chjeck. any help would be appreciated! cheers guys Graham Link to comment https://forums.phpfreaks.com/topic/282295-watermarking-image/ Share on other sites More sharing options...
Psycho Posted September 19, 2013 Share Posted September 19, 2013 Can you provide a sample of the wartermark image? FYI: Based upon the two links provided, it seems you used two different images for the watermark and you received two different results (one is partially transparent and the other is not transparent at all). Since the same code was changed, my initial reaction is that the difference is caused by the different images. Link to comment https://forums.phpfreaks.com/topic/282295-watermarking-image/#findComment-1450308 Share on other sites More sharing options...
graham23s Posted September 19, 2013 Author Share Posted September 19, 2013 Hi P, Ah that is because i messed with the opacity settings here: define('WATERMARK_OVERLAY_OPACITY', 100); I used 100 for the black one, and 50 for the transparent one Here is the latest one: http://www.camnev-electronics.com/img/img-wmLogo.png and another: http://www.camnev-electronics.com/img/wmlogo1.png I cannot figure it out at all lol cheers P Graham Link to comment https://forums.phpfreaks.com/topic/282295-watermarking-image/#findComment-1450313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.