alwaysme Posted December 30, 2007 Share Posted December 30, 2007 hi i got to install a watermark mod...however the background is not transparent! its always black and ugly...the file is a png transparent file...i tried with every transparent png i have and all the same result this is the code / begin watermark mod $is_image = (strpos($filedata['mimetype'], 'image/') !== false) ? true : false; if ($is_image) { require("includes/watermark/phpWatermark-0.3/phpWatermark.inc.php"); require("includes/watermark/config.php"); $wm = new watermark("files/".$filedata['physical_filename']); $wm->setPosition($watermark['position']); if ($watermark['type'] == 'text') { if ($watermark['text_color'] != 'auto') { $wm->setFixedColor($watermark['text_color']); } $wm->addWatermark($watermark['text'], "TEXT"); } elseif ($watermark['type'] == 'image') { $wm->addWatermark($watermark['image'], "IMAGE"); } $im = $wm->getMarkedImage(); imagepng($im, "files/".$filedata['physical_filename']); } // end watermark mod is it possible that php is responsible for tranparentcy? Quote Link to comment https://forums.phpfreaks.com/topic/83769-this-image-marker/ Share on other sites More sharing options...
JJohnsenDK Posted December 30, 2007 Share Posted December 30, 2007 hmm... is it possible to use gif images? if so, try to make your image a gif image... Quote Link to comment https://forums.phpfreaks.com/topic/83769-this-image-marker/#findComment-426225 Share on other sites More sharing options...
alwaysme Posted December 31, 2007 Author Share Posted December 31, 2007 i tried with a gif i still get a black background ;\ Quote Link to comment https://forums.phpfreaks.com/topic/83769-this-image-marker/#findComment-426309 Share on other sites More sharing options...
alwaysme Posted December 31, 2007 Author Share Posted December 31, 2007 i find some code that i use to use on another script a long time ago....the watermark was an addon and it work really well....maybe we can use something from the code for the above to make it right?? $watermark_ok = 0; if ($album_config['watermark_images'] == 1) { $marktype = substr($album_config['watermark_source'], strlen($album_config['watermark_source']) - 4, 4); switch ( $marktype ) { case '.png': $nm = imagecreatefrompng($album_config['watermark_source']); break; case '.gif': $nm = imagecreatefromgif($album_config['watermark_source']); break; case '.jpg': case 'jpeg': $nm = imagecreatefromjpeg($album_config['watermark_source']); break; default: $nm = false; } if ( $nm ) { $sx = imagesx($nm); $sy = imagesy($nm); switch ( $pic_filetype ) { case '.png': $im = imagecreatefrompng(ALBUM_UPLOAD_PATH . $thispic['pic_filename']); break; case '.gif': $im = imagecreatefromgif(ALBUM_UPLOAD_PATH . $thispic['pic_filename']); break; case '.jpg': case 'jpeg': $im = imagecreatefromjpeg(ALBUM_UPLOAD_PATH . $thispic['pic_filename']); break; default: $im = false; } if ( $im ) { $sx2 = imagesx($im); $sy2 = imagesy($im); imagecopymerge($im,$nm,($sx2 - $sx - 5), ($sy2 - $sy - 5), 0,0,$sx,$sy,40); $watermark_ok = 1; } } } if ($watermark_ok) { switch ( $pic_filetype ) { case '.png': case '.gif': header('Content-type: image/png'); imagepng($im); break; default: header('Content-type: image/jpeg'); imagejpeg($im); break; } } else { the problem is i dont understand much ??? Quote Link to comment https://forums.phpfreaks.com/topic/83769-this-image-marker/#findComment-426310 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.