Jump to content
Sign in to follow this  
orient

On The Fly Watermark Enhanced 1.1

Recommended Posts

Guest

I am new to using this contribution, but I have run into several snags with it and thought I would share my experiences.

 

Issue: watermarking works Great for NON-SSL, but does not work for SSL links

Resolution: I had to change my .htaccess file to check for SSL or NON-SSL and change the path to my image.php file accordingly.

 

I am using a SHARED SSL Certificate provided by iPowerWeb, Inc and my SSL paths are not the same as my NON-SSL paths. I used the following in my .htaccess to check for the existance of SSL then change the path according to whether or not it was being used.

 

RewriteCond %{HTTPS} on

RewriteEngine on

RewriteRule ^(.*)\.jpg {absolute_path}/images/{watermark_dir}/image.php?%{REQUEST_FILENAME}

RewriteCond %{HTTPS} !=on

RewriteEngine on

RewriteRule ^(.*)\.jpg {virtural_path}/images/{watermark_dir}/image.php?%{REQUEST_FILENAME}

 

Hope this save you alot of time trying to figure out what is going on.

 

Regard and Best of luck,

David

Share this post


Link to post
Share on other sites
Guest
is there any easy way to know if my server has GD enabled?

 

Yes, from the osCommerce Admin Menu, choose Tools: Server Info and scroll down to "GD Support" and see if it says "Enabled" or "Disabled".

Share this post


Link to post
Share on other sites
Yes, from the osCommerce Admin Menu, choose Tools: Server Info and scroll down to "GD Support" and see if it says "Enabled" or "Disabled".

 

ok I cheched it and its Enabled.

 

but when I m trying to see a .jpg file the response is :

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, service@webmailer.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

anyone help? the path is right... I copyied the Document Root Path from "Sever Info" of Admin area. My path is /home/*****/www/pe/www.**********.com/htdocs/catalog4/images/big/image.php

 

HELP!!

Share this post


Link to post
Share on other sites

Hi all

 

I installed the mod all ok and got it to work initially, but i was also getting the no image and just the red x where the image should have been, however in other categories is was working fine.

 

All I could work out was that in the categories it wasnt working they had a long path to that file where as the other categories had a shorter path.

 

eg I had a pat say

 

products/games/playstation/actionadventure/gta.jpg Image would show red x

 

products/games/playstation/rpg/gta.jpg Image works fine

 

 

Is there a limit on the length that the sub category can be labbelled??????

 

thanks

Share this post


Link to post
Share on other sites

I have installed fine and gd is enabled however i just get no image instead of my catalog picturres ? my pictures are in the corect format jpg? any sugestions

Share this post


Link to post
Share on other sites
I have installed fine and gd is enabled however i just get no image instead of my catalog picturres ? my pictures are in the corect format jpg? any sugestions

seems like no one read our questions here... :huh:

Share this post


Link to post
Share on other sites
Guest
ok I cheched it and its Enabled.

 

but when I m trying to see a .jpg file the response is :

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, service@webmailer.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

anyone help? the path is right... I copyied the Document Root Path from "Sever Info" of Admin area. My path is /home/*****/www/pe/www.**********.com/htdocs/catalog4/images/big/image.php

 

HELP!!

 

I am not an expert on this contriution, but it may be interpreting your "." in the path as a Regular Expression wildcard character. Also, the ABSOLUTE path should only be placed on the SECURE pages. Again, I am using a SHARED SSL Cert. and it may be different for a purchased SSL Certificate. With a shared SSL I have to use the "Hostname" instead of my Domain Name. I have put the same ".htaccess" file in each of the image directories that contain "ONLY" my product Images. All paths from each of my Images directories are the same from the image directory to the "image.php" script.

 

Here is how my directory structure is laid out:

 

/osCatalog/catalog/images

Share this post


Link to post
Share on other sites
Guest
ok I cheched it and its Enabled.

 

but when I m trying to see a .jpg file the response is :

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, service@webmailer.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

anyone help? the path is right... I copyied the Document Root Path from "Sever Info" of Admin area. My path is /home/*****/www/pe/www.**********.com/htdocs/catalog4/images/big/image.php

 

HELP!!

 

I am not an expert on this contriution, but it may be interpreting your "." in the path as a Regular Expression wildcard character. Also, the ABSOLUTE path should only be placed on the SECURE pages. Again, I am using a SHARED SSL Cert. and it may be different for a purchased SSL Certificate. With a shared SSL I have to use the "Hostname" instead of my Domain Name. I have put the same ".htaccess" file in each of the image directories that contain "ONLY" my product Images. All paths from each of my Images directories are the same from the image directory to the "image.php" script.

 

Here is how my directory structure is laid out:

 

/osCatalog/catalog/images

|

- graphics

| |

| -.htaccess

| - {all graphics for products}

|-letters-numbers

| |

| -.htaccess

| |

| -western_font

| |

| -{all my graphics for letters and numbers}

|

-watermark

| |

| -image.php

| -watermark.png

 

That is basically how I have my directory structure setup. Again this works on the Directory Structure and NOT the Categories of your products.

 

hope this helps and sorry I have not been on in a few days.

David

Share this post


Link to post
Share on other sites
Guest
Hi all

 

I installed the mod all ok and got it to work initially, but i was also getting the no image and just the red x where the image should have been, however in other categories is was working fine.

 

All I could work out was that in the categories it wasnt working they had a long path to that file where as the other categories had a shorter path.

 

eg I had a pat say

 

products/games/playstation/actionadventure/gta.jpg Image would show red x

 

products/games/playstation/rpg/gta.jpg Image works fine

Is there a limit on the length that the sub category can be labbelled??????

 

thanks

 

Not sure what is going on here, but from what you wrote here, I would assume that you are putting your categories as a path to the image. Do NOT use the categories as a path. The path is the DIRECTORY Path on your server hard drive.

 

Hope this helps,

David

Share this post


Link to post
Share on other sites
Not sure what is going on here, but from what you wrote here, I would assume that you are putting your categories as a path to the image. Do NOT use the categories as a path. The path is the DIRECTORY Path on your server hard drive.

 

Hope this helps,

David

 

categories as a path, what do you mean, all i have done is installed the watermark as per instructions to the root directory under a watermark folder then drop the .htaccess in all the image folders that i wanted watermarks on. is this not correct?

Share this post


Link to post
Share on other sites

oops sory double post ... see below

Edited by danil0

Share this post


Link to post
Share on other sites

ok I think I m gona crazy :'(

 

I tried everythink....

 

My .htaccess file is this:

RewriteEngine on

RewriteRule ^(.*)\.jpg /big/image.php?%{REQUEST_FILENAME}

 

My image.php file is this:

<?php

//watermark program

//Show that a jpeg image is going to be returned

//echo $QUERY_STRING;

//exit;

header("Content-type: image/jpeg");

 

//File names

$wmark='watermark.png';

$wmarks='watermark_s.png';

$mimage=$QUERY_STRING;

 

//Loading

$watermark_img = imagecreatefrompng($wmark);

$watermarks_img = imagecreatefrompng($wmarks);

 

$wmrk_size = getimagesize($wmark);

$wmrks_size = getimagesize($wmarks);

 

$main_img = imagecreatefromjpeg($mimage);

//ImageAlphaBlending($main_image, true);

 

//Merge the 2 buffers

//The figure "300" can be changed to any figure suitable for your situation.

 

if (ImageSX($main_img) > 300) {

$posx = (ImageSX($main_img) - ImageSX($watermark_img))/2;

$posy = (ImageSY($main_img) - ImageSY($watermark_img))/2;

imagecopy($main_img, $watermark_img, $posx, $posy, 0, 0, $wmrk_size[0], $wmrk_size[1]);

 

}else{

$posxs = (ImageSX($main_img) - ImageSX($watermarks_img))/2;

$posys = (ImageSY($main_img) - ImageSY($watermarks_img))/2;

imagecopy($main_img, $watermarks_img, $posxs, $posys, 0, 0, $wmrks_size[0], $wmrks_size[1]);

 

}

 

//Output file to browser

imagejpeg($main_img);

imagedestroy($watermark_img);

imagedestroy($watermarks_img);

imagedestroy($main_img);

?>

 

both files are in big/ folder with two watermark.png files

 

If I run the image.php file with IE the result is this:

<br>

<b>Warning</b>: imagecreatefromjpeg: Unable to open '' for reading in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>20</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>26</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>32</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>33</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>34</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>39</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>42</b><br>

 

If I will try to see an image with my explorer the result is this:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, service@webmailer.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

anyone help? the path is right... I copyied the Document Root Path from "Sever Info" of Admin area. My path is /home/strato/www/pe/www.**********.com/htdocs/catalog4/images/big/image.php

 

I tried every CHMOD in all files.

I checked that my server suports GD, here the results of server_info.php :

gd

GD Support enabled

GD Version 2.0 or higher

FreeType Support enabled

FreeType Linkage with freetype

GIF Read Support enabled

GIF Create Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

 

 

 

Please help me where is my mistake???

Edited by danil0

Share this post


Link to post
Share on other sites
Guest
ok I think I m gona crazy :'(

 

I tried everythink....

 

My .htaccess file is this:

RewriteEngine on

RewriteRule ^(.*)\.jpg /big/image.php?%{REQUEST_FILENAME}

 

My image.php file is this:

<?php

//watermark program

//Show that a jpeg image is going to be returned

//echo $QUERY_STRING;

//exit;

header("Content-type: image/jpeg");

 

//File names

$wmark='watermark.png';

$wmarks='watermark_s.png';

$mimage=$QUERY_STRING;

 

//Loading

$watermark_img = imagecreatefrompng($wmark);

$watermarks_img = imagecreatefrompng($wmarks);

 

$wmrk_size = getimagesize($wmark);

$wmrks_size = getimagesize($wmarks);

 

$main_img = imagecreatefromjpeg($mimage);

//ImageAlphaBlending($main_image, true);

 

//Merge the 2 buffers

//The figure "300" can be changed to any figure suitable for your situation.

 

if (ImageSX($main_img) > 300) {

$posx = (ImageSX($main_img) - ImageSX($watermark_img))/2;

$posy = (ImageSY($main_img) - ImageSY($watermark_img))/2;

imagecopy($main_img, $watermark_img, $posx, $posy, 0, 0, $wmrk_size[0], $wmrk_size[1]);

 

}else{

$posxs = (ImageSX($main_img) - ImageSX($watermarks_img))/2;

$posys = (ImageSY($main_img) - ImageSY($watermarks_img))/2;

imagecopy($main_img, $watermarks_img, $posxs, $posys, 0, 0, $wmrks_size[0], $wmrks_size[1]);

 

}

 

//Output file to browser

imagejpeg($main_img);

imagedestroy($watermark_img);

imagedestroy($watermarks_img);

imagedestroy($main_img);

?>

 

both files are in big/ folder with two watermark.png files

 

If I run the image.php file with IE the result is this:

<br>

<b>Warning</b>: imagecreatefromjpeg: Unable to open '' for reading in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>20</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>26</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>32</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>33</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>34</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>39</b><br>

<br>

<b>Warning</b>: Supplied argument is not a valid Image resource in <b>/mnt/ja1/05/940/00000002/htdocs/catalog4/images/big/image.php</b> on line <b>42</b><br>

 

If I will try to see an image with my explorer the result is this:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, service@webmailer.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

anyone help? the path is right... I copyied the Document Root Path from "Sever Info" of Admin area. My path is /home/strato/www/pe/www.**********.com/htdocs/catalog4/images/big/image.php

 

I tried every CHMOD in all files.

I checked that my server suports GD, here the results of server_info.php :

gd

GD Support enabled

GD Version 2.0 or higher

FreeType Support enabled

FreeType Linkage with freetype

GIF Read Support enabled

GIF Create Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

Please help me where is my mistake???

 

Just for clarification: (because of the statement above: both files are in big/ folder with two watermark.png files)

 

You should put the ".htaccess" file in the same folder as the images that are going to be displayed on the webpage. (not the folder with the "image.php" script)

 

The ".htaccess" file should go into each folder that contains the JPG Images you want to display with a watermark.

 

That is the only thing that I can notice. The contents of the files looks good.

 

Hope this helps!

David

Share this post


Link to post
Share on other sites
Just for clarification: (because of the statement above: both files are in big/ folder with two watermark.png files)

 

You should put the ".htaccess" file in the same folder as the images that are going to be displayed on the webpage. (not the folder with the "image.php" script)

 

The ".htaccess" file should go into each folder that contains the JPG Images you want to display with a watermark.

 

That is the only thing that I can notice. The contents of the files looks good.

 

Hope this helps!

David

I have the .htaccess in the same folder. in the big folder are :

  • .htaccess ,
  • watermark.png ,
  • image.php ,
  • testimage.jpg

.... am I forgeting something? where is the problem I can not understand.

Share this post


Link to post
Share on other sites

I updated .htaccess file as given in installation file. Updated .png files accordingly and upload image.php everything worked flawless.

 

Thanks a lot for the contribution.

Share this post


Link to post
Share on other sites
Guest
I have the .htaccess in the same folder. in the big folder are :
  • .htaccess ,
  • watermark.png ,
  • image.php ,
  • testimage.jpg

.... am I forgeting something? where is the problem I can not understand.

 

Daniel,

 

The ".htaccess" file does <b>NOT</b> go in the same folder ("/big") as the "image.php" script. The ".htaccess" file should go in the folder where you are storing the JPG graphics that you are looking to provide a watermark on.

 

David

Share this post


Link to post
Share on other sites
Daniel,

 

The ".htaccess" file does <b>NOT</b> go in the same folder ("/big") as the "image.php" script. The ".htaccess" file should go in the folder where you are storing the JPG graphics that you are looking to provide a watermark on.

 

David

 

I just tried to put it outside of the big/ folder but the result was the same. Error!

 

... yes I changed the path in the .htaccess file to right path. Otherwise when the path is wrong it saws me the picture I m requesting normaly.

And that means I believe that mabe there is a problem with the script. What do thing? :huh:

Share this post


Link to post
Share on other sites
Hi all

 

I installed the mod all ok and got it to work initially, but i was also getting the no image and just the red x where the image should have been, however in other categories is was working fine.

 

All I could work out was that in the categories it wasnt working they had a long path to that file where as the other categories had a shorter path.

 

eg I had a pat say

 

products/games/playstation/actionadventure/gta.jpg Image would show red x

 

products/games/playstation/rpg/gta.jpg Image works fine

Is there a limit on the length that the sub category can be labbelled??????

 

thanks

 

 

The directories quoted above are the directories to my image folders only, and still i have the same prob all images with a short directory work fine, but those in the long directory dont. why is this?

Share this post


Link to post
Share on other sites
Guest
The directories quoted above are the directories to my image folders only, and still i have the same prob all images with a short directory work fine, but those in the long directory dont. why is this?

 

That I am aware of, there should not be an issue with the length of that directory structure. Not sure why it is not working.

 

Sorry,

David

Share this post


Link to post
Share on other sites
Guest

I downloaded this today and after a few problems also, I finally figured out how to set it up correctly

 

1. Create a folder called watermark in your root (eg. public_html/watermark)

 

2. Open water.htaccess and insert your website address, so the file now reads

"RewriteEngine on

RewriteRule ^(.*)\.jpg http://www.***.com/watermark/image.php?%{REQUEST_FILENAME}

"

*** being YOUR OWN website address

 

3. Save the water.htaccess file

 

4. Upload image.php, noimg.png, watermark.png and watermark_s.php to the folder containg the images you want to mark

(my example: www.***.com/catalog/images)

 

5. Upload water.htaccess to the new folder you created called watermark

 

6. Rename water.htaccess to .htaccess

 

ENJOY :D

 

 

Would be interested to hear feedback if that helps/doesnt help anybody with problems

Share this post


Link to post
Share on other sites
Guest

Hi folk,

 

im using this wonderful contrib. Thanks to the author!

In my shop i have no Problems with watermarking the images.

But when i generate a datasheet with pdf datasheet the watermark is gone away :'( and you can see the normal picture.

Does somebody know about this problem?

Is there any solution?

Thanks a lot!

 

Greetings

 

Markus

Share this post


Link to post
Share on other sites
Guest

OK I have looked why the pictures in the generated pdf datasheet will not be marked with my watermark.

In the configfile for the datasheet is this variable "define('PDF_ALT_IMAGE', 'products_image');" defined.

I think thats the reason why it will not be watermarked...

Share this post


Link to post
Share on other sites

Hello,

 

I was using this contrib just fine on my old host, my new host is using PHP5, and I know I've had to make other script modifications to be PHP5 compliant, but I'm having issues making this contrib work.

 

Can anyone assist?!

 

Thanks.

Share this post


Link to post
Share on other sites
Hello,

 

I was using this contrib just fine on my old host, my new host is using PHP5, and I know I've had to make other script modifications to be PHP5 compliant, but I'm having issues making this contrib work.

 

Can anyone assist?!

 

Thanks.

 

Well, as is the usually when I have a question, I post it up, and a few minutes later I answer it myself.

 

I changed the following two lines to make this PHP5 compliant:

$mimage=$QUERY_STRING;

TO

$mimage=$_SERVER['QUERY_STRING'];

 

if (file_exists($QUERY_STRING)) {

TO

if (file_exists($mimage)) {

 

You would also have to do the same to some of the line that are commented out if you wished to view those comments for debugging or what not.

 

Hope this helps someone!

 

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×