Home | Downloads | Support | Purchase | Add-on Features
SazCart Support Forum
September 05, 2010, 01:44:20 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SazCart v1.5.1 Released!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Wattermark in a images ?  (Read 2516 times)
geminis
Newbie
*
Posts: 4


View Profile
« on: March 01, 2009, 10:26:17 am »

Hi i use a single code of php for put wattermark in my other sites, and i tryng to add it to a SAZ-CART.
The code is single but a little confused for me, any body can help me ? I am not really sure about wath scritp is the "post" image upload.
I asumed that admin/image-manager.php  is the post, and the form is admin/alayouts/pagtes/image-manager.php is the "form" but is a little confuse for me.
Regards.

here is the code:
<?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_y00$watermark_width$watermark_height100);  
imagejpeg($image);  
imagedestroy($image);  
imagedestroy($watermark);  

?>

PD: By the way, i am spanish speaker, sory for my bad english, if any spanish guy want to work with me on this feature is welcome to contact me.
Regards.
Logged
geminis
Newbie
*
Posts: 4


View Profile
« Reply #1 on: March 01, 2009, 05:15:26 pm »

ok, IS DONE ...! wass very simply in fact.

file: layout/default/pages/details.php

find:
<center><img src="<?print $_saz['settings']['site_url'] . $image;?>" alt="<?print $prod_details['prod_title'];?>" border="0" /></center>
Reemplace by:
<center><img src="watermark.php?i=<?print $_saz['settings']['site_url'] . $image;?>" alt="<?print $prod_details['prod_title'];?>" border="0" /></center>

Find:
<center><a href="<?print $_saz['settings']['site_url'] . $fullimage;?>" target="_blank"><?print $_saz['words']['enlarge'];?></a></center>
Reemplace by:
<center><a href="<?print $_saz['settings']['site_url']?>watermark.php?i=<? print $_saz['settings']['site_url'] . $fullimage;?>" target="_blank"><?print $_saz['words']['enlarge'];?></a></center>

Add the file watermark.php in root dir
<?php 

$image 
$_GET['i']; 
$watermark "water.png"

$im imagecreatefrompng($watermark); 

$ext substr($image, -3); 


if(
strtolower($ext) == "gif") { 
if (!
$im2 imagecreatefromgif($image)) { 
echo 
"Error opening $image!"; exit; 

} else if(
strtolower($ext) == "jpg") { 
if (!
$im2 imagecreatefromjpeg($image)) { 
echo 
"Error opening $image!"; exit; 

} else if(
strtolower($ext) == "png") { 
if (!
$im2 imagecreatefrompng($image)) { 
echo 
"Error opening $image!"; exit; 

} else { 
die; 


imagecopy($im2$im, (imagesx($im2)/2)-(imagesx($im)/2), (imagesy($im2)/2)-(imagesy($im)/2), 00imagesx($im), imagesy($im)); 

if(
$_GET[repeat]) { 
$waterless imagesx($im2) - imagesx($im); 
$rest ceil($waterless/imagesx($im)/2); 

for(
$n=1$n<=$rest$n++) { 
imagecopy($im2$im, ((imagesx($im2)/2)-(imagesx($im)/2))-(imagesx($im)*$n), (imagesy($im2)/2)-(imagesy($im)/2), 00imagesx($im), imagesy($im)); 
imagecopy($im2$im, ((imagesx($im2)/2)-(imagesx($im)/2))+(imagesx($im)*$n), (imagesy($im2)/2)-(imagesy($im)/2), 00imagesx($im), imagesy($im)); 



header("Content-Type: image/jpeg"); 
imagejpeg($im2); 
imagedestroy($im); 
imagedestroy($im2); 

?>

and finaly put a file water.png in root dir.
Thats all.

Regards.

Logged
saztar
Administrator
Sr. Member
*
Posts: 453

Ah!


View Profile
« Reply #2 on: March 02, 2009, 04:03:41 pm »

good deal, thanks for the post, hope it helps a few others looking to do the same.

Tony~!
Logged

geminis
Newbie
*
Posts: 4


View Profile
« Reply #3 on: March 02, 2009, 05:05:53 pm »

good deal, thanks for the post, hope it helps a few others looking to do the same.

Tony~!

No problem tony, any time. In first I was afraid that the script was violating the rules of the place. I`m glad to this little contribution help some body.
Regards.
Logged
saztar
Administrator
Sr. Member
*
Posts: 453

Ah!


View Profile
« Reply #4 on: March 02, 2009, 09:35:50 pm »

I personally have no problem and really encourage community support and additions.
Logged

geminis
Newbie
*
Posts: 4


View Profile
« Reply #5 on: March 03, 2009, 09:33:12 am »

ok, i glad to hear you ... i have many littles addes like thats, for ex. rotate banners in header, random scroll images down the menu, etc ... if you want, with time, i put all here.
See you.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1 RC2 | SMF © 2001-2005, Lewis Media