Permanant watermark with undo possibility (GD2+IM working!) + better admin tools - Page 5 Permanant watermark with undo possibility (GD2+IM working!) + better admin tools - Page 5
 

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]

Main Menu

Permanant watermark with undo possibility (GD2+IM working!) + better admin tools

Started by Stramm, March 31, 2006, 03:33:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

light2fire

    if ($watermark == "true"){
        $path_parts = pathinfo($CONFIG['watermark_file']);
        if (file_exists($path_parts["dirname"]."/".(USER_NAME).".png")) $wm_file = $path_parts["dirname"]."/".(USER_NAME).".png";
        else $wm_file = $CONFIG['watermark_file'];
    }


this piece?  :P

light2fire

Ok, I changed the picmgmt.inc.php .
I uploaded a watermark with the same name as a username.
But when I upload the basic watermark is added...  ???

function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark="false", $sharpen=0,$media_type="false")
{
    global $CONFIG, $ERROR;
    global $lang_errors;


    if ($watermark == "true"){
        $path_parts = pathinfo($CONFIG['watermark_file']);
        if (file_exists($path_parts["dirname"]."/".(USER_NAME).".png")) $wm_file = $path_parts["dirname"]."/".(USER_NAME).".png";
        else $wm_file = $CONFIG['watermark_file'];
    }


    $imginfo = getimagesize($src_file);
    if ($imginfo == null)
        return false;
        // GD can only handle JPG & PNG images
    if ($imginfo[2] != GIS_JPG && $imageinfo[2] != GIS_PNG && $CONFIG['GIF_support'] == 0) {
        $ERROR = $lang_errors['gd_file_type_err'];
        return false;
    }

claude258

Quote from: Stramm on September 06, 2006, 01:35:20 AM
Claude, I just uploaded a test pic and all worked smooth (no white page or any error at all) except that no watermark got applied. But that's no wonder at all cause you've set a web URL for the path. That'S plain wrong. Either use the absolute or relative path
relative path: images/watermark.png

Thanks Stramm. I changed the path for the watermark.png.

I just found that if I upload a image of 800X600 (about 60ko) it is OK no problem. But if I upload a image of 1200X900 (about 200ko) I have the errors reported before. The image you uploaded with success was 640X480. I dont understand  ???

I tried to play with the config but no success.

The config for image is set as:
Max width or height of an intermediate picture/video: 800
Max size for uploaded files (KB): 3000
Max width or height for uploaded pictures (pixels): 1400

Link to the site:
http://www.fur4x-hebergement.net/claude/cpg149/index.php
debog is available.

Thanks.
claude



Joachim Müller

@light2fire: this thread is for cpg1.4.x only. You're not allowed to ask questions for the outdated cpg1.3.x version of this mod in this thread. In fact, support for cpg1.3.x is running out. Instead of adding yet another mod to your cpg1.3.x-driven gallery I suggest you make up your mind on upgrading from cpg1.3.x to cpg1.4.x instead.

Stramm

Claude, you run into server sided limitations. Watermarking needs some more mem cause your box has to handle 2 pics instead of only one. Read the stickies in the upload support forums to get an idea what to do. Also you could (if installed) switch to ImageMagick

GauGau, light2fire is using 1.4 but asking how to port a function that was only avail in the 1.3 watermark mod

light2fire, that's not all changes. Search for the var $wm_file further more in picmgmnt.inc.php.
$CONFIG['watermark_file'] has been replaced with it. Not doing that change will result in having only the orig watermark.

light2fire

@stramm

yes :D found the replacement after some minutes. Changed it
} else { // shrink not enabled or no intermediate...
$logoImage = ImageCreateFromPNG($CONFIG['watermark_file']);

to
} else { // shrink not enabled or no intermediate...
$logoImage = ImageCreateFromPNG($wm_file);


Now it works for me (1.4.9) thx  ;D

claude258

As you can see I am working hard to add this mod to my site but I have some problems :-\.
Now I am trying to add it to www.claudebriere.net. I made all the changes in the files including reduced watermark and run update.php.

1) With HTTP upload (as admin), after I choose the album to place the first uploaded image, I get a white page with the following error:
QuoteFatal error: Call to undefined function: get_auto_subscribe_post() in /home/claudeb/public_html/coppermine/include/picmgmt.inc.php on line 167
But image is added correctly with watermark on resized and original. Of course, I can't place remaining images in appropriate albums.

2) With FTP upload, it seems to work but the watermark is added on resized image only (both rezised and original choosen in config). Note that I get DP remark for each images even if all images were new ??? (as you know DP means that the file is a duplicate and is already in the database).

3) Also, when I try to use the admin tools I get a white page withe the following error:
QuoteParse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/claudeb/public_html/coppermine/util.php on line 52

I think I followed the mod instructions correctly. I tried a few times with the same results.

Claude

Stramm

1. looks like you once had the modpack installed -> in your with phpmyadmin open your coppermine config table. Find the entry enable_user_notification and either delete it or set it to 0 (zero)

2. has been asked and answered in this thread and the modpack thread (file/ folder permissions is the magic)

3. I'd say you've made a mistake when applying the mod

claude258

Thanks Stramm it is OK now ;D.

The only thing is that I dont know how to get a watermark like yours. You said that you use Paint. Is it microsoft Paint? I have this software on my computer but I dont know how to get a watermark like yours. I want the text to be transparent but I can't get it.

Is there other way to produce watermark like this? I search the web but watermark tutorials were not for watermark like yours.

I also tried to enter numbers in ''Set color transparent x, y (GD2 only)'' but it did not seems to have an effect on the watermark tranparency. What numbers should I write?

I know it should be easy to do but I dont get it.... :-\ 

Stramm

What exactly want you do? My sample watermark is pretty basic. Just black text...

maybe the docs will help you to achive what you want
http://forum.coppermine-gallery.net/index.php?topic=28367.msg131255#msg131255

claude258

My watermark:
http://claudebriere.net/coppermine/displayimage.php?pos=-1688

Your watermark:
http://claudebriere.net/coppermine/displayimage.php?pos=-1689

As you can see, my watermark as no transparency. I dont know how to get that transparency whit Microsoft Paint, PhotoFiltre or others... ??? Or can you do it for me ::)? (''claudebriere.net'' about same size, tranparency, etc...  as your watermak).

Or can I get it with ''Set color transparent x, y (GD2 only)'' ? Which number should I write?

Thanks again.
Claude

Stramm

QuoteIf you use GD2 then the transparency setting in config has no function. If you want the watermark to be transparent against the background, then reduce layer transparency of your watermark image in your paint proggy to eg. 50 (this I did for the sample watermark)...

In your paint program (I'm using Photoshop) you set the layer transparency to a value you like (40-60 usually is not bad at all). I never looked at MS Paint and never heared about PhotoFiltre so I can't help you with these.

Set color transparent x, y (GD2 only) has a total different functionality. Let's say pixel x34, y15 of your watermark image is white and you set 34, 15 in config for color transparent, then GD2 would try to eliminate white out of the watermark image. However it doesn't look really cool so I already thought about removing that feature.

Stramm

I've attached a sample... width 400px so you can use it with the downsize feature
edit: layer transparency = 50%

claude258


Scuba_Si

Hey Stramm,

I have everything working other than the actual watermark.  Everything gets imported ok, there's just no watermark present.  My files are not big (max dimension 600px)

I have read through this topic from page 1 to 5 several times now and im still lost!  I have a watermark.png file in my images folder ( Coppermine_directory/images/watermark.png). 

my link in my config is set to "images/watermark.png"

My CHMOD options on a linux server are set to 666 for the files and 777 for the folders.  I am using GD not imagemagick.

I have performed an update again, and still no luck!

Please help!

Simon

Stramm

Please post a link to your gallery and a testuser account with permissions to upload pics

Maybe you want to try either to reduce the watermark size or to increase the mem limit. Looks to me like a resource problem

in include/picmgmnt.inc.php add
@ini_set('memory_limit', '32M');
after
if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...');}

this will not work in all environments. Depending on your php configuration you may have to set the mem limit in your php.ini
Read the sticky thread in the 1.4 upload problems forum to learn more about server sided restrictions

Scuba_Si

Hi Stramm,

Thanks for the info,

I am currently reloading coppermine onto my server with your modpack.  I will try the resource issues, and if i still cant work it out i will do as advised and post an account/link for you.

Thanks for your help,

Simon

Scuba_Si

Thanks Stramm,

Got it working now, its great! I must have made an error in my script editing.


Thanks for your help, and if you need any info on the underwater stuff please feel free to ask.

Simon

jerx

Is it possible to watermark thumbnails, too?

I think the watermark would not be readable if you downsize the watermark as much as the picture. So it would be nice to be able to downsize the watermark to a configurable width.

zerillos

            
                                    
now just replace include/picmgmnt.inc.php with the attached one

Where is that ? ???