Permanant watermark with undo possibility (GD2+IMagick) - Page 10 Permanant watermark with undo possibility (GD2+IMagick) - Page 10
 

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+IMagick)

Started by Stramm, March 26, 2005, 06:09:36 PM

Previous topic - Next topic

0 Members and 11 Guests are viewing this topic.

Stramm

no, never heared about that problem. I even don't know where it hangs cause there are several 'continue' buttons on different pages when you upload.

First thing to check would be the new MySQL entries. You've updated the necessary MySQL and it's in your db (correct prefix etc)

jbinc

i attached a picture to show you which section its having a problem on. Itll just stay on this page after i click continue to finalize the upload of the picture. If i have the watermark turned off then it works fine.

Stramm

can you zip your cpg main dir and include dir (without your config.inc.php) and then email me the zipfile? I'd like to have a look (please ICQ me for the email addy). Still I guess it's some memory, timeout stuff or similar.

jbinc

Quote from: Stramm on October 14, 2005, 12:07:39 PM
can you zip your cpg main dir and include dir (without your config.inc.php) and then email me the zipfile? I'd like to have a look (please ICQ me for the email addy). Still I guess it's some memory, timeout stuff or similar.

sent pm

thanks for looking into this matter

pgrzegorc

Stramm,

I can't see in your hack source code that I can assign a few watermarks for my gallery, because I gave about 10 persons to access to download images to my gallery and I NEED 10 watermarks, one watermark for one person, and I can't see if you can applied to more than one watermark to the source code, e.g.

into db:
insert into cpg_config (name, value) values ('enable_watermark', '1');
insert into cpg_config (name, value) values ('where_put_watermark', 'bottomright');
insert into cpg_config (name, value) values ('watermark_file', '/your/full/path/to/logo.png');
insert into cpg_config (name, value) values ('which_files_to_watermark', 'both');
insert into cpg_config (name, value) values ('orig_pfx', 'orig_');
insert into cpg_config (name, value) values ('watermark_transparency', '0');
insert into cpg_config (name, value) values ('watermark_transparency_featherx', '0');
insert into cpg_config (name, value) values ('watermark_transparency_feathery', '0');

and you still added one watermark, could you tell me how I should added a few watermarks for my gallery???


Pawel

Quote from: Stramm on March 26, 2005, 06:09:36 PM
This mod is based on the 'Permanent Watermark with GD2 mod'.
However I've rewritten the entire thing cause I didn't like the drawbacks of original 'Permanent Watermark with GD2 mod'
That mod did image resize -> save -> image resize -> save -> watermark -> save
with each step losing image quality... and an unnecesary load on the box

so that's fixed


hacks of the mod to be found in this thread:
- admin can disable watermarking whilst upload (checkbox added to upload form)
- possibility to assign different watermarks to certain users.
- better admin tool to add/ remove/ update watermarks to thumbs/ normal/ full images

added
a) an undo function. If you want to get rid of your watermarks or apply new ones. No problem. You can do that without any loss in image quality or having 2,3,4 watermarks on the image
b) watermarks can be transparent (so you can see the original image through it)
c) supports imagemagick and GD2
d) watermark can be in the center now as well
modified
in config Watermark Image on upload has been changed to Watermark Image
-> it's global now. So in Admin Tools just use 'Update thumbs and/or resized photos' to apply or remove watermarks
added a new function in Admin Tools as well if you want to delete the backup images... however then you won't be able to undo watermarks. If no watermarks are actually applied.. no problem. Go ahead and delete them. If you later create watermarks it auto creates backup images.

If you upload pictures and watermarking is disabled then no backup images get created. Only if you enable watermarking. So it doesn't waste a lot of HD

The advantage of watermarking is that full sized images get compressed. So if you upload a 2000x1000 digicam picture it may have 1.5+mb. When watermarking it get's compressed down to ~300k (depending on image quality you've set) saving you a lot of bw.

The settings in Coppermine config:
Watermark Image - Yes/No
Where to place the watermark - select a spot where your watermark should appeare
Which files to watermark - normal sized, full sized or both
Which file to use for watermark - enter full path to your watermark image
note:
GD2 needs a png (24)
Imagemagick -> jpg, gif, png with the last two you can have a transparent background
So just create in PS a Text in a second layer, delete to bg layer and save as gif or png transparent. If you use png take 24bit otherwise you'll have funny results (with GD2)

Transparency 0-100 for entire image - makes the entire watermark transparent to the bg (100 for no transparency)
Set color transparent x,y (GD2 only) - if you want to enable this uncomment the following line in picmgmnt.inc.php

//imagecolortransparent($logoImage, imagecolorat($logoImage, $CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery']));


what it does... if you haven't created a png with a transparent background but a white one you can select the color white (you need to know the coordinates where white appeares on the watermark, usually 1,1 fits) and GD renders white fully transparent

If it works for you as it's doing for me... or if you have problems... --> feedback appreciated


Stramm

Quote from: jbinc on October 14, 2005, 03:35:42 PM
sent pm

thanks for looking into this matter

just checked it.. all working smooth here. Have seen that you're using the phpbb bridge. This may cause the troubles. If you have a free min.. can you try to remove the bridge and thentry watermarking a test image?

If it works ... then remove the mod pack and just apply the watermark hack. Culprit then is the comment notification (a guess)

jbinc


jbinc

Quote from: Stramm on October 15, 2005, 01:07:48 PM
Quote from: jbinc on October 14, 2005, 03:35:42 PM
sent pm

thanks for looking into this matter

just checked it.. all working smooth here. Have seen that you're using the phpbb bridge. This may cause the troubles. If you have a free min.. can you try to remove the bridge and thentry watermarking a test image?

If it works ... then remove the mod pack and just apply the watermark hack. Culprit then is the comment notification (a guess)

i removed the bridge but its still lagging


jbinc

Quote from: Stramm on October 15, 2005, 02:11:54 PM
if you don't mind http://forum.coppermine-gallery.net/index.php?topic=5841.0

but not sure how this is affecting it when the watermark is on, it only lags when the watermark is enabled, when its turned off its fine. I'll try playing around with it, but let me know as well while im working on it thanks

Stramm

sorry, copied the wrong link ;)
a testuser account, and a link to your site would be great. If you enable single file upload and debug it would be great

Stramm

Strange, can't say much. You use a png24 watermark file, you have enough mem for each php process and the path to the wm file is the absolute one and it's correct?

jbinc

Quote from: Stramm on October 15, 2005, 03:19:30 PM
Strange, can't say much. You use a png24 watermark file, you have enough mem for each php process and the path to the wm file is the absolute one and it's correct?

yep, the absolute path is in the images folder and i can view it by typing in the url, so the png image is viewable and working. I guess ill just reinstall and erase the db and just try installing the wm mod.

pgrzegorc

I read your suggestion for individual users Stramm but I can't still see watermark for my individual users ( I prepared of course watermark for each users and the name's watermark is the same as name of user e.g. for Marcin user is Marcin.png watermark

I turn on debugging from configuration section and during uploading I got:

Notice: Undefined offset: 2 in /www/mass_vhosts/www.tbop.sylaba.pl/htdocs/gallery/upload.php on line 250

Notice: Undefined offset: 3 in /www/mass_vhosts/www.tbop.sylaba.pl/htdocs/gallery/upload.php on line 256

Notice: Undefined offset: 4 in /www/mass_vhosts/www.tbop.sylaba.pl/htdocs/gallery/upload.php on line 256

debugging information:

USER:
------------------
Array
(
    [ID] => 28170a5fb740e0164e6bbaa6877492ae
    [am] => 1
    [liv] => Array
        (
           
  • => 262
                [1] => 263
                [2] => 264
                [3] => 265
                [4] => 266
            )

        [theme] => classic
        [uid] => 6
    )

    ==========================
    USER DATA:
    ------------------
    Array
    (
        [user_id] => 1
        [user_group] => 1
        [user_active] => YES
        [user_name] => admintbop
        [user_password] => ********
        [user_lastvisit] => 2005-10-16 10:14:18
        [user_regdate] => 2005-02-22 07:16:09
        [user_group_list] =>
        [user_email] =>
        [user_website] =>
        [user_location] => Kielce
        [user_interests] =>
        [user_occupation] => web gallery admin
        [user_actkey] =>
        [disk_max] => 2048
        [disk_min] => 2048
        [can_rate_pictures] => 1
        [can_send_ecards] => 1
        [ufc_max] => 3
        [ufc_min] => 3
        [custom_user_upload] => 0
        [num_file_upload] => 5
        [num_URI_upload] => 3
        [can_post_comments] => 1
        [can_upload_pictures] => 1
        [can_create_albums] => 1
        [has_admin_access] => 1
        [pub_upl_need_approval] => 0
        [priv_upl_need_approval] => 0
        [group_name] => Administrators
        [upload_form_config] => 3
        [group_quota] => 2048
        [can_see_all_albums] => 1
        [group_id] => 1
        [groups] => Array
            (
                [1] => 1
            )

    )

    ==========================
    Queries:
    ------------------
    Array
    (
       
  • => SELECT extension, mime, content FROM tbop_filetypes;
        [1] => SELECT * FROM tbop_users WHERE user_id='1'AND user_active = 'YES' AND user_password != '' AND BINARY MD5(user_password) = 'b415573b8df6e3233f83cd1d81bbf0b3'
        [2] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM tbop_usergroups WHERE group_id in (1)
        [3] => SELECT group_name FROM  tbop_usergroups WHERE group_id= 1
        [4] => DELETE FROM tbop_banned WHERE expiry < 1129452849
        [5] => SELECT * FROM tbop_banned WHERE ip_addr='213.134.171.180' OR ip_addr='213.134.171.180' OR user_id=1
    )

    ==========================
    GET :
    ------------------
    Array
    (
    )

    ==========================
    POST :
    ------------------
    Array
    (
    )

    ==========================
    VERSION INFO :
    ------------------
    PHP version: 4.3.11 - OK
    ------------------
    mySQL version: 4.1.10a-standard
    ------------------
    Coppermine version: 1.3.2
    ==========================
    Module: gd
    ------------------
    GD Support enabled
    GD Version bundled (2.0.28 compatible)
    FreeType Support enabled
    FreeType Linkage with freetype
    GIF Read Support enabled
    GIF Create Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    XBM Support enabled
    ==========================
    Module: mysql
    ------------------
    Active Persistent Links 0
    Active Links 1
    Client API version 4.0.17
    MYSQL_MODULE_TYPE none
    MYSQL_SOCKET /tmp/mysql.sock
    MYSQL_INCLUDE no value
    MYSQL_LIBS no value
    ==========================
    Module: zlib
    ------------------
    ZLib Support enabled
    Compiled Version 1.1.4
    Linked Version 1.1.4
    ==========================
    Server restrictions (safe mode)?
    ------------------
    Directive | Local Value | Master Value
    safe_mode | On | Off
    safe_mode_exec_dir | /usr/local/bin | no value
    safe_mode_gid | Off | Off
    safe_mode_include_dir | no value | no value
    safe_mode_exec_dir | /usr/local/bin | no value
    sql.safe_mode | Off | Off
    disable_functions | no value | no value
    file_uploads | On | On
    include_path | .: | .:
    open_basedir | no value | no value
    ==========================
    email
    ------------------
    Directive | Local Value | Master Value
    sendmail_from | no value | no value
    sendmail_path | /usr/sbin/sendmail -t -i  | /usr/sbin/sendmail -t -i
    SMTP | localhost | localhost
    smtp_port | 25 | 25
    ==========================
    Size and Time
    ------------------
    Directive | Local Value | Master Value
    max_execution_time | 30 | 30
    max_input_time | 60 | 60
    upload_max_filesize | 2M | 2M
    post_max_size | 8M | 8M
    ==========================
    Page generated in 0.31 seconds - 6 queries in 0.087 seconds - Album set :


    In next step I got:
    Notice: Undefined variable: file_failure_array in /www/mass_vhosts/www.tbop.sylaba.pl/htdocs/gallery/upload.php on line 1940

    Notice: Undefined variable: URI_failure_array in /www/mass_vhosts/www.tbop.sylaba.pl/htdocs/gallery/upload.php on line 1941

    Notice: Undefined variable: zip_failure_array in /www/mass_vhosts/www.tbop.sylaba.pl/htdocs/gallery/upload.php on line 1942

    USER:
    ------------------
    Array
    (
        [ID] => 28170a5fb740e0164e6bbaa6877492ae
        [am] => 1
        [liv] => Array
            (
               
  • => 262
                [1] => 263
                [2] => 264
                [3] => 265
                [4] => 266
            )

        [theme] => classic
        [uid] => 6
    )

    ==========================
    USER DATA:
    ------------------
    Array
    (
        [user_id] => 1
        [user_group] => 1
        [user_active] => YES
        [user_name] => admintbop
        [user_password] => ********
        [user_lastvisit] => 2005-10-16 10:14:18
        [user_regdate] => 2005-02-22 07:16:09
        [user_group_list] =>
        [user_email] =>
        [user_website] =>
        [user_location] => Kielce
        [user_interests] =>
        [user_occupation] => web gallery admin
        [user_actkey] =>
        [disk_max] => 2048
        [disk_min] => 2048
        [can_rate_pictures] => 1
        [can_send_ecards] => 1
        [ufc_max] => 3
        [ufc_min] => 3
        [custom_user_upload] => 0
        [num_file_upload] => 5
        [num_URI_upload] => 3
        [can_post_comments] => 1
        [can_upload_pictures] => 1
        [can_create_albums] => 1
        [has_admin_access] => 1
        [pub_upl_need_approval] => 0
        [priv_upl_need_approval] => 0
        [group_name] => Administrators
        [upload_form_config] => 3
        [group_quota] => 2048
        [can_see_all_albums] => 1
        [group_id] => 1
        [groups] => Array
            (
                [1] => 1
            )

    )

    ==========================
    Queries:
    ------------------
    Array
    (
       
  • => SELECT extension, mime, content FROM tbop_filetypes;
        [1] => SELECT * FROM tbop_users WHERE user_id='1'AND user_active = 'YES' AND user_password != '' AND BINARY MD5(user_password) = 'b415573b8df6e3233f83cd1d81bbf0b3'
        [2] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM tbop_usergroups WHERE group_id in (1)
        [3] => SELECT group_name FROM  tbop_usergroups WHERE group_id= 1
        [4] => DELETE FROM tbop_banned WHERE expiry < 1129453169
        [5] => SELECT * FROM tbop_banned WHERE ip_addr='213.134.171.180' OR ip_addr='213.134.171.180' OR user_id=1
    )

    ==========================
    GET :
    ------------------
    Array
    (
    )

    ==========================
    POST :
    ------------------
    Array
    (
        [URI_array] => Array
            (
               
  • =>
                [1] =>
                [2] =>
            )

        [control] => phase_1
    )

    ==========================
    VERSION INFO :
    ------------------
    PHP version: 4.3.11 - OK
    ------------------
    mySQL version: 4.1.10a-standard
    ------------------
    Coppermine version: 1.3.2
    ==========================
    Module: gd
    ------------------
    GD Support enabled
    GD Version bundled (2.0.28 compatible)
    FreeType Support enabled
    FreeType Linkage with freetype
    GIF Read Support enabled
    GIF Create Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    XBM Support enabled
    ==========================
    Module: mysql
    ------------------
    Active Persistent Links 0
    Active Links 1
    Client API version 4.0.17
    MYSQL_MODULE_TYPE none
    MYSQL_SOCKET /tmp/mysql.sock
    MYSQL_INCLUDE no value
    MYSQL_LIBS no value
    ==========================
    Module: zlib
    ------------------
    ZLib Support enabled
    Compiled Version 1.1.4
    Linked Version 1.1.4
    ==========================
    Server restrictions (safe mode)?
    ------------------
    Directive | Local Value | Master Value
    safe_mode | On | Off
    safe_mode_exec_dir | /usr/local/bin | no value
    safe_mode_gid | Off | Off
    safe_mode_include_dir | no value | no value
    safe_mode_exec_dir | /usr/local/bin | no value
    sql.safe_mode | Off | Off
    disable_functions | no value | no value
    file_uploads | On | On
    include_path | .: | .:
    open_basedir | no value | no value
    ==========================
    email
    ------------------
    Directive | Local Value | Master Value
    sendmail_from | no value | no value
    sendmail_path | /usr/sbin/sendmail -t -i  | /usr/sbin/sendmail -t -i
    SMTP | localhost | localhost
    smtp_port | 25 | 25
    ==========================
    Size and Time
    ------------------
    Directive | Local Value | Master Value
    max_execution_time | 30 | 30
    max_input_time | 60 | 60
    upload_max_filesize | 2M | 2M
    post_max_size | 8M | 8M
    ==========================
    Page generated in 0.359 seconds - 6 queries in 0.088 seconds - Album set :


    Quote from: Stramm on March 26, 2005, 06:09:36 PM
    This mod is based on the 'Permanent Watermark with GD2 mod'.
    However I've rewritten the entire thing cause I didn't like the drawbacks of original 'Permanent Watermark with GD2 mod'
    That mod did image resize -> save -> image resize -> save -> watermark -> save
    with each step losing image quality... and an unnecesary load on the box

    so that's fixed


    hacks of the mod to be found in this thread:
    - admin can disable watermarking whilst upload (checkbox added to upload form)
    - possibility to assign different watermarks to certain users.
    - better admin tool to add/ remove/ update watermarks to thumbs/ normal/ full images

    added
    a) an undo function. If you want to get rid of your watermarks or apply new ones. No problem. You can do that without any loss in image quality or having 2,3,4 watermarks on the image
    b) watermarks can be transparent (so you can see the original image through it)
    c) supports imagemagick and GD2
    d) watermark can be in the center now as well
    modified
    in config Watermark Image on upload has been changed to Watermark Image
    -> it's global now. So in Admin Tools just use 'Update thumbs and/or resized photos' to apply or remove watermarks
    added a new function in Admin Tools as well if you want to delete the backup images... however then you won't be able to undo watermarks. If no watermarks are actually applied.. no problem. Go ahead and delete them. If you later create watermarks it auto creates backup images.

    If you upload pictures and watermarking is disabled then no backup images get created. Only if you enable watermarking. So it doesn't waste a lot of HD

    The advantage of watermarking is that full sized images get compressed. So if you upload a 2000x1000 digicam picture it may have 1.5+mb. When watermarking it get's compressed down to ~300k (depending on image quality you've set) saving you a lot of bw.

    The settings in Coppermine config:
    Watermark Image - Yes/No
    Where to place the watermark - select a spot where your watermark should appeare
    Which files to watermark - normal sized, full sized or both
    Which file to use for watermark - enter full path to your watermark image
    note:
    GD2 needs a png (24)
    Imagemagick -> jpg, gif, png with the last two you can have a transparent background
    So just create in PS a Text in a second layer, delete to bg layer and save as gif or png transparent. If you use png take 24bit otherwise you'll have funny results (with GD2)

    Transparency 0-100 for entire image - makes the entire watermark transparent to the bg (100 for no transparency)
    Set color transparent x,y (GD2 only) - if you want to enable this uncomment the following line in picmgmnt.inc.php

    //imagecolortransparent($logoImage, imagecolorat($logoImage, $CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery']));


    what it does... if you haven't created a png with a transparent background but a white one you can select the color white (you need to know the coordinates where white appeares on the watermark, usually 1,1 fits) and GD renders white fully transparent

    If it works for you as it's doing for me... or if you have problems... --> feedback appreciated

Stramm

don't post debug info unless I ask you. It just clutters the site.

You didn't give me much info despite your users pictures don't get watermarked with their individual watermark. Nice.. but what happens instead. Do the images get watermarked at all. Have you defined a fallback watermark. Is this one on the images. Does an error occur (that's at first far more important than the dubug output) and if yes, what is the exact error message?
I suppose you've set the correct absolute path to your fallback watermark image in config?

pgrzegorc

I set correct whole watermark path in config earlier yet , I don't have any idea what is wrong, everything should be ok but not is :-(.


Quote from: Stramm on October 16, 2005, 11:58:07 AM
don't post debug info unless I ask you. It just clutters the site.

You didn't give me much info despite your users pictures don't get watermarked with their individual watermark. Nice.. but what happens instead. Do the images get watermarked at all. Have you defined a fallback watermark. Is this one on the images. Does an error occur (that's at first far more important than the dubug output) and if yes, what is the exact error message?
I suppose you've set the correct absolute path to your fallback watermark image in config?

Stramm

as said.. tell me more.. tell me the things I asked for an dtell me the path you're using

pgrzegorc

I'm using path:
/www/mass_vhosts/www.tbop.sylaba.pl/htdocs/gallery/watermark1.png

you can check this path using php function phpinfo() which is in test.php in:
http://www.tbop.org.pl/test.php
and you can see that this path is correct but gallery still doesn't include watermark :-( to any pictures.

I have right mode of this files: I changed to 777 mode.
I have pictmgn into include folder
and watermark is right as well

but I don't have any idea what is wrong :-(

Regards,
Pawel

Quote from: Stramm on October 17, 2005, 09:07:53 AM
as said.. tell me more.. tell me the things I asked for an dtell me the path you're using

Stramm

you haven't set watermarks fully transparent? Try 50%

If you don't get any errors then try the standard watermark picmgmnt.inc.php from site 1 of this thread. Then we can see if it's a general problem or one with the multi watermarks