Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Watermark full size image...but not thumbnail?


gnu

Recommended Posts

I've got the image watermark contribution working on my install. It works great... can I somehow make it where the thumbnails do not show the watermark, but the full-size images do?

 

As is, the thumbnails and the full size images both show the watermark.

 

Thanks for a great piece of software!

Edited by gnu
Link to comment
Share on other sites

I've got the image watermark contribution working on my install.  It works great...  can I somehow make it where the thumbnails do not show the watermark, but the full-size images do?

 

As is, the thumbnails and the full size images both show the watermark.

 

Thanks for a great piece of software!

 

If you use the "On The Fly Thumbnail" contrib, it doesn't show the watermark. In addition, I also added an IF statement around the code that adds the watermark so that other small .jpgs don't get the watermark. I've rearranged the original code so here is all of it. Watermark_Image.php:

 

<?php
//watermark program
//Show that a jpeg image is going to be returned
//echo $QUERY_STRING;
//exit;
header("Content-type: image/jpeg");

//File names
$MainImage=$QUERY_STRING;
$main_img = imagecreatefromjpeg($MainImage);
$Main_Image_width = imageSX($main_img); 
$Main_Image_height = imageSY($main_img); 

if ($Main_Image_height >= 150)
{
 $WaterMark='watermark3.gif';
 $WaterMark_Transparency = "50";
 $watermark_img = imagecreatefromgif($WaterMark);
 imagecolortransparent($watermark_img,0);
 $wmrk_size = getimagesize($WaterMark);

 $WaterMark_width = imageSX($watermark_img); 
 $WaterMark_height = imageSY($watermark_img);

 // This will be the position of the WaterMark 
 $MaterMark_x = ($Main_Image_width - $WaterMark_width) / 2; 
 $MaterMark_y = ($Main_Image_height - $WaterMark_height) / 2;

 //Merge the 2 buffers
 imagecopymerge($main_img,$watermark_img,$MaterMark_x,$MaterMark_y,0,0,$wmrk_size[0],$wmrk_size[1],$WaterMark_Transparency); 
 //or
 //imagecopy($main_img,$watermark_img,0,0,0,0,$wmrk_size[0],$wmrk_size[1]);

 //Release our watermark image
 imagedestroy($watermark_img);
}

//Output file to browser
imagejpeg($main_img);
imagedestroy($main_img);

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...