Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 2 3 [4]   Go Down

Author Topic: Another watermark mod (simpliest available) GD2 compatiable  (Read 75270 times)

0 Members and 1 Guest are viewing this topic.

surjo_becarz

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Another watermark mod (simpliest available) GD2 compatiable
« Reply #60 on: November 13, 2005, 10:30:19 pm »

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
Logged

bingnet

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
It works!
« Reply #61 on: November 15, 2005, 10:02:47 am »

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

Difficulties:  ???
« Last Edit: November 15, 2005, 10:13:59 am by bingnet »
Logged

amirw2k

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 37
Re: Watermark for ver 1.42
« Reply #62 on: November 30, 2005, 11:44:26 am »

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:
Code: [Select]
$filepathname = $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
Replace with these lines:

 
Code: [Select]
    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:

 
Code: [Select]
   
      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
Logged
Pages: 1 2 3 [4]   Go Up
 

Page created in 0.018 seconds with 20 queries.