Jump to content

Watermarks addon changes Rate Topic   - - - - -

 
  • mattls
  • Junior Member
  • Members
  • Join Date: 24-Jan 10
  • 20 posts

Posted 03 April 2011 - 10:26 PM #1

Please see the post below for a better how to install and update to the files!

Attached Files



 
  • netra4u
  • Member
  • Members
  • Join Date: 09-Jan 08
  • 64 posts

Posted 08 April 2011 - 07:57 PM #2

mattls said:

I have a simple way of watermarking all your detailed store images without ever having to do anything. Its done through .htaccess request. EG user clicks on a link to display and is shown the thumb with no image. They click to get a bigger image and its water marked.

Just do the following:
-Upload the .htacess file to your /images/detailed (or for that matter any dir that you want water marked.)
-Create a dir name wartermark
-add files : w.php & also your watermark image (which i called mark.png can be changed by editing the php file)

Thats it!

Dont know if this helps any one or not but sure makes it easier for me to just create the products & not have to do anything else.


I tried this but I am getting X mark for my detail images

What is EG user ?

is server need to setup something ?
CS-Cart Version 2.2.4

 
  • mattls
  • Junior Member
  • Members
  • Join Date: 24-Jan 10
  • 20 posts

Posted 09 April 2011 - 01:57 AM #3

netra4u said:

I tried this but I am getting X mark for my detail images

What is EG user ?

is server need to setup something ?

If your store is listed in a sub-dir you will need to edit the .htaccess file where it is :
RewriteRule .(gif|jpeg|jpg|png)$ /watermark/w.php [QSA,NC]

make sure and set it to : RewriteRule .(gif|jpeg|jpg|png)$ /YOUR STORE NAME/watermark/w.php [QSA,NC]

other wise you need to make sure your server is set to handle image creation, make sure you have GD Lib and ImageMagick installed.

This should handle any errors your getting. Please let me know otherwise and Ill take a look into it.

 
  • netra4u
  • Member
  • Members
  • Join Date: 09-Jan 08
  • 64 posts

Posted 09 April 2011 - 04:38 AM #4

mattls said:

If your store is listed in a sub-dir you will need to edit the .htaccess file where it is :
RewriteRule .(gif|jpeg|jpg|png)$ /watermark/w.php [QSA,NC]

make sure and set it to : RewriteRule .(gif|jpeg|jpg|png)$ /YOUR STORE NAME/watermark/w.php [QSA,NC]

other wise you need to make sure your server is set to handle image creation, make sure you have GD Lib and ImageMagick installed.

This should handle any errors your getting. Please let me know otherwise and Ill take a look into it.

It works now. Thank You

How can I make watermark position to center ?
CS-Cart Version 2.2.4

 
  • mattls
  • Junior Member
  • Members
  • Join Date: 24-Jan 10
  • 20 posts

Posted 09 April 2011 - 04:38 PM #5

netra4u said:

It works now. Thank You

How can I make watermark position to center ?

Simple, in the php file edit like this:
--------------------
FIND THIS:
--------------------
$startwidth = (($imagewidth - $watermarkwidth) );
$startheight = (($imageheight - $watermarkheight) );

--------------------
REPLACE WITH:
--------------------
$startwidth = (($imagewidth - $watermarkwidth) /2);
$startheight = (($imageheight - $watermarkheight) /2);

replacing with that will center the watermark. You can mess with that number and it should change where the watermark is located. Fairly simple.

 
  • tbirnseth
  • Senior Member
  • Members
  • Join Date: 08-Nov 08
  • 5,239 posts

Posted 09 April 2011 - 06:17 PM #6

Since this thread was started by CS for their new addon, suggest you start another thread for a different implementation. Otherwise people are going to get confused as to what's what.

One is a Mod and one is an Addon. Two very different things.
EZ Merchant Solutions

Authorized Reseller - Cart licenses: $305 (lowest reseller price)
Custom B2B Development, Consulting and Special Projects (get a quote).
Commercial addons to meet your business and operations needs.

http://www.ez-ms.com

 
  • Struck
  • Teetering on Genious
  • Members
  • Join Date: 07-Mar 09
  • 2,457 posts

Posted 09 April 2011 - 09:48 PM #7

tbirnseth said:

Since this thread was started by CS for their new addon, suggest you start another thread for a different implementation. Otherwise people are going to get confused as to what's what.

One is a Mod and one is an Addon. Two very different things.

Agreed, my thoughts exactly! :confused:
Cooking with Gas on Version 3.0.6 Professional

 
  • tennyy
  • Junior Member
  • Members
  • Join Date: 23-Apr 10
  • 1 posts

Posted 15 April 2011 - 05:31 AM #8

mattls said:

If your store is listed in a sub-dir you will need to edit the .htaccess file where it is :
RewriteRule .(gif|jpeg|jpg|png)$ /watermark/w.php [QSA,NC]

make sure and set it to : RewriteRule .(gif|jpeg|jpg|png)$ /YOUR STORE NAME/watermark/w.php [QSA,NC]

other wise you need to make sure your server is set to handle image creation, make sure you have GD Lib and ImageMagick installed.

This should handle any errors your getting. Please let me know otherwise and Ill take a look into it.

Hi,

I already try this method, but still not working.

I using rewrite to host multiple domains

RewriteEngine On

RewriteCond %{HTTP_HOST} shop.com

RewriteCond %{REQUEST_URI} !shop/

RewriteRule ^(.*)$ shop/$1 [L]

Even I set /watermark/w.php or /shop/watermark/w.php still doesn't work.

How can I solve it?

Thanks!

 
  • Billlee
  • Junior Member
  • Members
  • Join Date: 03-Jun 11
  • 38 posts

Posted 10 August 2011 - 08:35 AM #9

EDIT: Got it working

 
  • Billlee
  • Junior Member
  • Members
  • Join Date: 03-Jun 11
  • 38 posts

Posted 10 August 2011 - 04:09 PM #10

EDIT: Got it working

 
  • Scott_C
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 166 posts

Posted 23 August 2011 - 10:08 AM #11

I have to say, this mod has worked beautifully for me. I didn't completely understand the instructions at first, but one I put the watermarking folder (that has w.php and the actual watermarked image) in the root of my cscart site, and the .htaccess file in the images/detailed folder (as I only want to watermark the largest popup images) all is working as it should.

 
  • mattls
  • Junior Member
  • Members
  • Join Date: 24-Jan 10
  • 20 posts

Posted 27 August 2011 - 10:09 PM #12

Alright sorry for the delay to getting back to everyone. Well I haven't watched the forum because everyone was saying that I posted this little mod in the wrong place so I figured why should I help these people when all they are doing is bashing me.. Anyways I want to help anyone that has a question about this..

Let me go over a few things.. First this isn't dependent on cs-cart in any way and does not matter what version of cs-cart you are running. Even if its version 100.1 20 years from now. As long as the dir structure stays the same it will work fine.

Next, this in NO WAY SHAPE OR FORM will not make your images "pop up" like they used to. Once again like I said this doesnt edit any file on cs-carts side. If you dont delete the .htaccess file in the images/detailed/ dir then this will happen as the .htaccess file is trying to send the image to get watermarked.

This also will not change anything with your lightbox as stated above you forgot to delete the .htaccess file in the images dir.

Now I will reword and try to help you better understand how to install this mod.

I have revised the zip file for a little more direction on how to edit the files and made a dir structure to help on upload.

In the .htaccess file which is located in the dir /images/detailed/ it will look like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .(gif|jpeg|jpg|png)$ /watermark/w.php [QSA,NC]

If you have your store and all it's dir in a sub dir example: /store you will need to edit the .htaccess file as so:
RewriteRule .(gif|jpeg|jpg|png)$ /watermark/w.php [QSA,NC] <----- the bold needs to be edited to where you uploaded the watermark dir so if its /store then edit its to RewriteRule .(gif|jpeg|jpg|png)$ /store/watermark/w.php [QSA,NC]

Next is the watermark script its self, no editing should be needed unless you would like to change the location on the watermark or the name of your png watermark file. You will notice that your watermark image will need to be a png file!
The default name of this file is watermark.png and its located in the same folder as the w.php file!

That is it, it's very simple to use and install! Any questions feel free to message me before bashing me or the program for your user editing that is causing the problems! I dont mean to be harsh with what I say just when people are ungrateful for something given to them for free then start bashing them, it's uncalled for..

Lastly, if you need this mod and cant seem to figure out how to install it.. I can install it on your system for you given FTP access to your site. Unfortunately my labor is not free but for a small fee I can get this installed and working!

Please remember that this program requires GD Lib and ImageMagick installed

Attached Files



 
  • Scott_C
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 166 posts

Posted 28 August 2011 - 01:59 AM #13

Well I'd like to say thanks Matt. After some initial head-scratching I figured out the mod and its working beautifully. Really saved us, as we have a lot of custom, high-res product photo's that we've taken ourselves. We didn't want the competition stealing them!

Cheers,

Scott.

 
  • Billlee
  • Junior Member
  • Members
  • Join Date: 03-Jun 11
  • 38 posts

Posted 28 August 2011 - 04:10 AM #14

Hello Mattls,

I want to start by apologizing for my rude behavior. You are offering a FREE addon after all and I had no right to act that way, especially when you are trying to help people out.

So please forgive me for acting childish as I did, I was frustrated and acted out of ignorance. :rolleyes:

Second. I finally got it working!

I think the issue was that I put the watermark dir in the detailed images dir, and not in the root dir.

The second issue was that on the first post you said you named your water mark image "mark.png"

So I did the same, not realizing that it should be "watermark.png".

Anyhow, it works great now!


Do you have a donate button anywhere? :)


Regards,
Bill

 
  • mattls
  • Junior Member
  • Members
  • Join Date: 24-Jan 10
  • 20 posts

Posted 28 August 2011 - 02:47 PM #15

Its no problem I really just wanted everyone to enjoy a great script that would save us all from stole images. Im glade you all go it working and I know my first set and maybe even the second set of instructions (destructions) were not clear. Im not that good at explaining how to use / install scripts or mods. I did kinda just throw it all together without showing a dir structure. That is why I updated the files and the zip file to have the correct dir structure as I was almost cretin that was the problem. Im glad everyone is happy and if you all got any questions feel free to ask.

 

Posted 30 September 2011 - 08:36 AM #16

I think if you have a store with huge traffic, this script will slow down the storefront rendering. I think the best way, that you store these images with watermark.

 
  • fish1981
  • Member
  • Members
  • Join Date: 28-Nov 11
  • 16 posts

Posted 28 November 2011 - 05:41 PM #17

Hello all.
I have added some instructions to cache generated images.
Images with watermark will be stored in /wm/images/detailed/0/ directory.
So it will be only one generation of watermark.
After that every request will be forwarded to existing file.


<?php
// this script creates a watermarked image from an image file - can be a .jpg .gif or .png file
// where mark.png is a mostly transparent gif image with the watermark - goes in the same directory as this script
// where this script is named w.php


function sendfile($imagewm){
$fp = fopen($imagewm, 'rb');

// send the right headers
header("Content-Type: image");
header("Content-Length: " . filesize($imagewm));

// dump the picture and stop the script
fpassthru($fp);
fclose($fp);
return;
}

$imagesource = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
$imagewm = $_SERVER['DOCUMENT_ROOT'].'/wm'.$_SERVER['REQUEST_URI'];

if ( file_exists($imagewm) ){
sendfile($imagewm);
return;
}else{

$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 = @imagecreatefrompng('lp.png');
$imagewidth = imagesx($image);
$imageheight = imagesy($image);  
$watermarkwidth =  imagesx($watermark);
$watermarkheight =  imagesy($watermark);
$startwidth = 0;//(($imagewidth - $watermarkwidth) );
$startheight = (($imageheight - $watermarkheight) );
imagecopy($image, $watermark,  $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);
imagejpeg($image,$imagewm,90);
sendfile($imagewm);
imagedestroy($image);
imagedestroy($watermark);
}

?>


 
  • akistdm
  • Advanced Member
  • Trial users
  • Join Date: 09-Oct 11
  • 72 posts

Posted 14 June 2012 - 08:27 AM #18

it's all ok except of the images in the option combinations.
when i tick "watermark this image" and click save,nothing happens.it says yous changes have been saved but its unticked again.
does anyone have the same problem?

 
  • akistdm
  • Advanced Member
  • Trial users
  • Join Date: 09-Oct 11
  • 72 posts

Posted 02 July 2012 - 09:48 AM #19

edit:
got it working!works perfect!

 
  • vantienart
  • Newbie
  • Trial users
  • Join Date: 27-Jul 11
  • 3 posts

Posted 06 May 2013 - 12:58 AM #20

it working!works perfect!
How to move it to the left.

Posted Image