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]   Go Down

Author Topic: Urgent help with watermarking excesive consume cpu with script "on the air"  (Read 3804 times)

0 Members and 1 Guest are viewing this topic.

ale

  • Coppermine newbie
  • Offline Offline
  • Posts: 14

I have a problem with watermaking they have just sent an email those of the server saying to me that have suspended the service of hosting for using 77 % of resources of the CPU, and that or I arrange or me exit. I this am sure enough that it is for watermarking, I use this adjustment for gd image:

Hi everybody,

I made an modification to greg's great script cpg 1.1.

What does it?
It add's a .png watermark image to all your photo's and protects them from stealing
The script adds an image you specify to all your images. This will be done everytime, so the "original" image won't be harmed!!!
With htaccess you can protect your coppermine/albums/ directory: the server will have acces to the files, user(browsers) will need a password: (only if they try to steal the original images without the watermark, the images with the watermark are displayed in the CPG)

How to install?

step 1: find the file include/functions.inc.php,
go to the last lines, line 814 (824 in the nuke port) looks like:

Code:
 return $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);


change it to:

Code:
 return 'logo.php?picturename='.$url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);


step 2: make a .png file which contains your logo (or just an png file with text), name it logo.png.

step 3: make a logo.php file with the folowing content:

Code:

<?
// SCHIPT BY DJ AXION
// e-mail: DJ@the-expansion.com
// Enjoy this script!

// GET SOURCE PICTURE FROM FORM INPUT
$b = imagecreatefromjpeg($picturename) or die ("Could not create from JPEG");
$bx = imagesx($b); // source width
$by = imagesy($b); // source height


$lm = $b;

if ($bx > 200)  {  // this ensures no watermark is added to small images (e.g. thumbnails)
// ADD WATERMARK
$pos = "bottomright"; //where is the watermark displayed...

if ($pos == "topleft") {
$src_x = 0;
$src_y = 0;
} else if ($pos == "topright") {
$src_x = $bx - 193;
$src_y = 0;
} else if ($pos == "bottomleft") {
$src_x = 0;
$src_y = $by - 187;
} else if ($pos == "bottomright") {
$src_x = $bx - 90;
$src_y = $by - 90;
}
// THIS IS THE CODE FOR THE WATERMARK
ImageAlphaBlending($lm, true) or die ("Could not alpha blend"); // Enable when on GD 2+
$logoImage = ImageCreateFromPNG('logo.png'); // logo.png is a watermark it add's...
$logoW = ImageSX($logoImage);
$logoH = ImageSY($logoImage);
ImageCopy($lm,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH);
}


Imagejpeg($lm,'',80); //80 means JPEG quality
imageDestroy($lm);
?>


step 4 upload these 2 files to your cpg root directory, OR, to your website root directory when using the port.

That's it!

All the images will be save now! (except the thumbnails, because they are too small to add a watermark...)

Greetz,
DJ Axion

P.S. The logo.php file requires GD 2+


I need is that someone says to me the way of adapting it in order that it does not consume so too many resources of cpu since this script does the watermarking "on the air". I know an adjustment of another script in order that this excessive consumption was not taking produced of cpu but I don,t found, if can help me please.

Not Know exactly if the place is this where I have to write this post, if it is not like that forgive me the managers.


thanks in advance

best regards
Logged

Nibbler

  • Guest
Re: Urgent help with watermarking excesive consume cpu with script "on the air"
« Reply #1 on: September 23, 2004, 10:37:27 pm »

That is on-the-fly watermarking and will cause high CPU load due to it's very nature. Look into a permanent watermarking solution.
Logged

ale

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Urgent help with watermarking excesive consume cpu with script "on the air"
« Reply #2 on: September 23, 2004, 11:36:28 pm »

Quote
That is on-the-fly watermarking and will cause high CPU load due to it's very nature. Look into a permanent watermarking solution


yeah, I was not remembering the exact name

There is some way of realizing this without the watermarking realize "on the fly" without having to do this manually, a time ago I saw a script who was avoiding this.
Logged

Nibbler

  • Guest
Re: Urgent help with watermarking excesive consume cpu with script "on the air"
« Reply #3 on: September 24, 2004, 12:09:28 am »

Yes, there is a permanent watermarking mod on the mods board, you may have to upgrade to 1.3.2 to use it, which is of course recommended anyway.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Urgent help with watermarking excesive consume cpu with script "on the air"
« Reply #4 on: September 24, 2004, 05:33:17 am »

please do a search before posting next time...

Joachim
Logged

ale

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Urgent help with watermarking excesive consume cpu with script "on the air"
« Reply #5 on: September 24, 2004, 03:47:28 pm »

Hellow already I have looked but not found nothing, since some of the post of watermaking I found them confunse, it can be because my English  is very bad. Someone can help me to look for this topic in concretly for the version 1.2.1, for this way not to have to adapt template to the new version

Logged
Pages: [1]   Go Up
 

Page created in 0.015 seconds with 18 queries.