| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Displaying watermarks on product images | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Displaying watermarks on product images
I couldn't find an easy mod to display watermarks on product images, so I came up with a bit of a hack to do it.
PLEASE NOTE: - It will only work if you store your images on the filesystem. - If you use different images depending on the product variants this will NOT work for you. - Only tested on v4.3.1 on a somewhat basic site - Use at your own risk. Step 1: Copy this script and put it in the root (tweak as needed) <?php // this script creates a watermarked image from an image file - can be a .jpg .gif or .png file // where watermark.png or watermark.gif is a mostly transparent png or gif image with the watermark - goes in the same directory as this script // where this script is named picture.php // call this script with an image tag // <img src="/picture.php?path=T/productpic.png"> $basebpath = "http://www.domain.com/cart/images/"; $imagesource = $basebpath . $_GET['path']; $filetype = substr($imagesource,strlen($imagesource)-4,4); $filetype = strtolower($filetype); if($filetype == ".gif") $image = @imagecreatefromgif($imagesource); if($filetype == ".jpg") $image = @imagecreatefromjpeg($imagesource); if($filetype == ".png") $image = @imagecreatefrompng($imagesource); if (!$image) die(); //$watermark = @imagecreatefromgif('watermark.gif'); // uncomment to use a gif $watermark = @imagecreatefrompng('watermark.png'); // comment to use a gif $imagewidth = imagesx($image); $imageheight = imagesy($image); $watermarkwidth = imagesx($watermark); $watermarkheight = imagesy($watermark); $startwidth = (($imagewidth - $watermarkwidth)/2); // tweak this to change the location of the watermark $startheight = (($imageheight - $watermarkheight)/2); // tweak this to change the location of the watermark imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> Step 2: Edit /cart/skin1/product_thumbnail.tpl Replace the line (this is the hack because the _t breaks the variant images javascript): {if $id ne ''} id="{$id}"{/if} src=" with: {if $id ne ''} id="{$id}_t"{/if} src=" Replace this line: {$tmbn_url|amp} with: {$tmbn_url|amp|replace:'/cart/images/':'/picture.php?path='}
__________________
|| E L E V E N || |
|||||||
|
#2
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
Hi,
Thanks for your codes.Now is it possible to right click protected and drag and drop image in a folder in order to avoid image saving?? |
|||||||
#3
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
you can add this to the <body> tag to right-click protect:
oncontextmenu="return false;" There's really no way to stop someone from saving a picture from any site. If you can see it you can take a screen capture.
__________________
|| E L E V E N || |
|||||||
#4
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
Hey I was trying this on 4.3.2 and I'm not having any results.
Is there some kind of change between 4.3.1 & 4.3.2 that would affect this?
__________________
X-Cart 4.3 Joomla Among other things |
|||||||
#5
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
Nevermind, I got it. the /cart/images, needed to be /images for me in the thumbnail file.
I do however want this on my detailed images as well. Is this possible?
__________________
X-Cart 4.3 Joomla Among other things |
|||||||
#6
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
It should be possible with the detailed images. Off the top of my head, try looking at /skin1/modules/Detailed-Product_Images/product_images.tpl.
__________________
|| E L E V E N || |
|||||||
#7
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
Thanks. I was looking for it, but couldn't remember where it was I'll give it a shot and post what I have.
My clients product photos appears to be landing on scam sites.
__________________
X-Cart 4.3 Joomla Among other things |
|||||||
#8
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
Well I tried a few things, but I'm not getting anywhere. I'll try again tomorrow.
__________________
X-Cart 4.3 Joomla Among other things |
|||||||
#9
|
|||||||
|
|||||||
Re: Displaying watermarks on product images
I never could figure out how to get the watermark on the extra images.
__________________
X-Cart 4.3 Joomla Among other things |
|||||||
|
|||
X-Cart forums © 2001-2020
|