Another watermark mod (simpliest available) GD2 compatiable - Page 4 Another watermark mod (simpliest available) GD2 compatiable - Page 4
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Another watermark mod (simpliest available) GD2 compatiable

Started by skybax, August 14, 2004, 10:44:29 PM

Previous topic - Next topic

0 Members and 7 Guests are viewing this topic.

surjo_becarz

I have done every thing as instructed but it's not working it'a giving out this error Warning: imagecreatefromjpeg(albums/userpics/10018/thumb_04112005%28019%29.jpg): failed to open stream: No such file or directory in /home/bdcarzc/public_html/gallery/include/watermark.class.php on line 176
Could not create from JPEG

bingnet

#61
 :D It worked for me!  see it in action on cpg 1.3.3 : http://gallery.tefilah.net

Difficulties:  ???

amirw2k

This is very nice  :)

I'm using ver 1.42 and I had to try it for myself, so from a first look it works perfectly with a small change to the code.

The only problem with this script is that the watermarked files aren't getting deleted so it can overload the hard-disk if you don't delete them manually.

In order to install on 1.42, do the following:
1. Copy the file watermark.class.php into the include directory (all files are attached in the first message)
2. Copy the file watermark.png to the image directory
3. Create a directory under the albums directory and call it "watermark". CHMOD it to 777.
4. Now here is the change - instead of changing the file functions.inc.php as instructed, replace the following lines:

In the file include/functions.inc.php

Look for this line:
$filepathname = $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);

Replace with these lines:

    if ($pic_row['user1']!="YES")
    {

$filepathname =  $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);

    } else {
require_once "include/watermark.class.php";
//$watermark_file_location = 'images/watermark.png';
$watermark_file_location = 'images/watermark.png';
$picture_location = $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);;

$img = new Watermark();
$img->watermark_file = $watermark_file_location;
    $img->add_watermark($picture_location);
$filepathname = $img->image_tag;

    }


Remember that you must put the value "YES" in the field user1 in order for it to work.

I wanted it to automatically watermark all the images so I removed this condition like this:

   
    if (1!=1)
    //if ($pic_row['user1']!="YES")
    {

$filepathname =  $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);

    } else {
require_once "include/watermark.class.php";
//$watermark_file_location = 'images/watermark.png';
$watermark_file_location = 'images/watermark.png';
$picture_location = $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);;

$img = new Watermark();
$img->watermark_file = $watermark_file_location;
    $img->add_watermark($picture_location);
$filepathname = $img->image_tag;

    }

This way, the first line will be ignored always, and you can still go back to the original code if you wish.

Have fun and thanks for the mod,

Amir W