forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Watermarking & image manipulation => Topic started by: Stramm on March 26, 2005, 06:09:36 pm

Title: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on March 26, 2005, 06:09:36 pm
This mod is based on the 'Permanent Watermark with GD2 mod (http://forum.coppermine-gallery.net/index.php?topic=7160.0)'.
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
Code: [Select]
//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
Title: Re: Permanent Watermark with GD2 mod mod
Post by: Stramm on March 26, 2005, 06:39:12 pm
If you're using GD2 with PHP5... and your watermark doesn't look very pretty have a look here http://forum.coppermine-gallery.net/index.php?topic=16286.msg98094#msg98094

life demo (online when I'm working, register without email confirmation) http://stramm.mine.nu

downloadable already edited files http://forum.coppermine-gallery.net/index.php?topic=21469.0

so let's start

first the necessary SQL
Code: [Select]
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');

now open lang/english.php
find
$lang_config_php
and add
Code: [Select]
 'wm_bottomright' => 'Bottom right',
  'wm_bottomleft' => 'Bottom left',
  'wm_topleft' => 'Up left',
  'wm_topright' => 'Up Right',
  'wm_center' => 'Center',
  'wm_both' => 'Both',
  'wm_original' => 'Original',
  'wm_resized' => 'Resized',

after
Code: [Select]
array('Display notices in debug mode', 'debug_notice', 1), //cpg1.3.0add
Code: [Select]
'Image watermarking',
array('Watermark Image', 'enable_watermark', 1),
array('Where to place the watermark', 'where_put_watermark', 11),
array('Which files to watermark', 'which_files_to_watermark', 12),
array('Which file to use for watermark', 'watermark_file', 0),
array('Transparency 0-100 for entire image', 'watermark_transparency', 0),
array('Set color transparent x (GD2 only)', 'watermark_transparency_featherx', 0),
array('Set color transparent y (GD2 only)', 'watermark_transparency_feathery', 0),


after
Code: [Select]
'delete_orphans' => 'Delete orphaned comments (works on all albums)',   
add
Code: [Select]
 'update_full' => 'Both normal and full sized (if a orig copy is available)',
  'delete_back' => 'Delete original image backup (if you do that you can not undo watermarking)',


in
$lang_delete_php
add
Code: [Select]
 'orig_pic' => 'original image',


now we change config.php
above
function create_form(&$data)



Code: [Select]
function form_watermark($text, $name)
{
    global $CONFIG, $lang_config_php;

    $value = $CONFIG[$name];
    $southeast_selected = ($value == 'southeast') ? 'selected' : '';
    $southwest_selected = ($value == 'southwest') ? 'selected' : '';
    $northwest_selected = ($value == 'northwest') ? 'selected' : '';
    $northeast_selected = ($value == 'northeast') ? 'selected' : '';
    $center_selected = ($value == 'center') ? 'selected' : '';

    echo <<<EOT
        <tr>
            <td class="tableb">
                        $text
        </td>
        <td class="tableb" valign="top">
                        <select name="$name" class="listbox">
                                <option value="southeast" $southeast_selected>{$lang_config_php['wm_bottomright']}</option>
                                <option value="southwest" $southwest_selected>{$lang_config_php['wm_bottomleft']}</option>
                                <option value="northwest" $northwest_selected>{$lang_config_php['wm_topleft']}</option>
                                <option value="northeast" $northeast_selected>{$lang_config_php['wm_topright']}</option>
                                <option value="center" $center_selected>{$lang_config_php['wm_center']}</option>
                        </select>
                </td>
        </tr>

EOT;
}
// Added for allowing user to select which files to watermark...
function form_watermark2($text, $name)
{
    global $CONFIG, $lang_config_php;

    $value = $CONFIG[$name];
    $both_selected = ($value == 'both') ? 'selected' : '';
    $original_selected = ($value == 'original') ? 'selected' : '';
    $resized_selected = ($value == 'resized') ? 'selected' : '';

    echo <<<EOT
        <tr>
            <td class="tableb">
                        $text
        </td>
        <td class="tableb" valign="top">
                        <select name="$name" class="listbox">
                                <option value="both" $both_selected>{$lang_config_php['wm_both']}</option>
                                <option value="original" $original_selected>{$lang_config_php['wm_original']}</option>
                                <option value="resized" $resized_selected>{$lang_config_php['wm_resized']}</option>
                        </select>
                </td>
        </tr>

EOT;
}


Find this:

Code: [Select]
               case 10 :
                    form_number_dropdown($element[0], $element[1]);
                    break;

Few lines below is
Code:
die('Invalid action');
Now we need to paste this code in between

Code: [Select]
              //Watermark place
               case 11 :
                   form_watermark($element[0], $element[1]);
                                       break;
               //Which filest to watermark
               case 12 :
                   form_watermark2($element[0], $element[1]);
                                       break;
               case 13 :
                   // do nothing
                   break;


open util.php   

after        
Code: [Select]
' . $lang_util_php['update_what'] . ' (2):<br />
add below some similar lines
Code: [Select]
<input type="radio" name="updatetype" value="3" id="full" class="nobg" /><label for="full" accesskey="a" class="labelradio">' . $lang_util_php['update_full'] . '</label><br />
a few lines below
find
Code: [Select]
   starttable('100%', '<input type="radio" name="action" value="delnorm" id="delnorm" class="nobg" /><label for="delnorm" accesskey="e" class="labelradio">' . $lang_util_php['delete_original'] . '</label> (1)');
    endtable();
    print '<br />';

and below add

Code: [Select]
   starttable('100%', '<input type="radio" name="action" value="delback" id="delback" class="nobg" /><label for="delback" accesskey="e" class="labelradio">' . $lang_util_php['delete_back'] . '</label> (1)');
    endtable();
    print '<br />';


find    deleteorig();
and after add



Code: [Select]
   echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'delback') {
    print '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
    print '<h2>' . $lang_util_php['replace_wait'] . '</h2>';

    deletbackup_img();
   

find function deleteorphans() and above   
   
Code: [Select]

function deletbackup_img()
{
    global $picturetbl, $CONFIG, $lang_util_php;
    $albumid = $_POST['albumid'];

    $query = "SELECT * FROM $picturetbl WHERE aid = '$albumid'";
    $result = MYSQL_QUERY($query);
    $num = mysql_numrows($result);

    $i = 0;
    while ($i < $num) {
        $pid = mysql_result($result, $i, "pid");
        $back = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . $CONFIG['orig_pfx'] . mysql_result($result, $i, "filename");

        if (file_exists($back)) {
if(unlink($back)){
                printf($lang_util_php['main_success'], $back);
                print '!<br>';
}
            } else {
                printf($lang_util_php['error_rename'], $back);
            }
        ++$i;
    }
}


replace the function updatethumbs() with (you need to delete the entire function... not only the name)
Code: [Select]
function updatethumbs()
{
set_time_limit(3600);
    global $picturetbl, $CONFIG, $lang_util_php;
    $phpself = $_SERVER['PHP_SELF'];
    $albumid = $_POST['albumid'];
    $updatetype = $_POST['updatetype'];
    $numpics = $_POST['numpics'];
    $startpic = 0;
    $startpic = $_POST['startpic'];

    $query = "SELECT * FROM $picturetbl WHERE aid = '$albumid'";
    $result = MYSQL_QUERY($query);
    $totalpics = mysql_numrows($result);
$watermark="";

    if ($startpic == 0) {
        // 0 - numpics
        $num = $totalpics;
        // Over picture limit
        if ($totalpics > $numpics) $num = $startpic + $numpics;
    } else {
        // startpic - numpics
        $num = $startpic + $numpics;
        if ($num > $totalpics) $num = $totalpics;
    }

    $i = $startpic;
    while ($i < $num) {
$imagepath=mysql_result($result, $i, "filepath");
$imagefilename=mysql_result($result, $i, "filename");
$orig=$CONFIG['fullpath'] . $imagepath . $CONFIG['orig_pfx'] . $imagefilename;
        $image = $CONFIG['fullpath'] . $imagepath . $imagefilename;
$work_image = $image;
$orig_true='false';
if (file_exists($orig)) {
$work_image=$orig;
$orig_true='true';
}
else
$work_image=$image;
        if ($updatetype == 0 || $updatetype == 2) {
            $thumb = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . $CONFIG['thumb_pfx'] . mysql_result($result, $i, "filename");

            if (resize_image($work_image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false")) {
                print $thumb .' '. $lang_util_php['updated_succesfully'] . '!<br />';
                my_flush();
            } else {
                print $lang_util_php['error_create'] . ':$thumb<br />';
                my_flush();
            }
        }

        if ($updatetype == 1 || $updatetype == 2 || $updatetype == 3)
{
            $normal = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . $CONFIG['normal_pfx'] . mysql_result($result, $i, "filename");
            if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized')
{$watermark="true";}
else
{$watermark="false";}
            $imagesize = getimagesize($work_image);
            if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'])
{
                if (resize_image($work_image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], $watermark))
{
                    print $normal . $lang_util_php['updated_succesfully'] . '!<br />';
                    my_flush();
}
                else
{
                    print $lang_util_php['error_create'] . ':$normal<br />';
                    my_flush();
}
}
}
       
        if ($updatetype == 3)
{
if ($orig_true == 'false')
{
if (copy($image, $orig))
{        
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')
{
if (resize_image($orig, $image, $imagesize[0], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "true"))
{
             print $image . $lang_util_php['updated_succesfully'] . '!<br />';
             my_flush();
}
}
}
}
else
{
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')
{
        $imagesize = getimagesize($orig);
if (resize_image($orig, $image, $imagesize[0], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "true"))
{
             print $image . $lang_util_php['updated_succesfully'] . '!<br />';
             my_flush();
}
}
else
{
if (copy($orig, $image))
{
                    print $orig . $lang_util_php['updated_succesfully'] . '!<br />';
                    my_flush();
}
}
}
}

        ++$i;
    }
    $startpic = $i;

    if ($startpic < $totalpics) {

        ?>
            <form action=<?php echo $phpself;
        ?>
method="post">
                    <input type="hidden" name="action" value="continuethumbs" />
                    <input type="hidden" name="numpics" value="<?php echo $numpics?>" />
                    <input type="hidden" name="startpic" value="<?php echo $startpic?>" />
                    <input type="hidden" name="updatetype" value="<?php echo $updatetype?>" />
            <input type="hidden" name="albumid" value="<?php echo $albumid?>" />
            <input type="submit" value="<?php print $lang_util_php['continue'];
        ?>
" class="submit" /></form>
                    <?php
    
}
}



now delete.php

find a block similar to the one below and replace (just colspan has been adjusted)
Code: [Select]
   // Picture

    case 'picture':
        if (!(GALLERY_ADMIN_MODE || USER_ADMIN_MODE)) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

        $pid = (int)$HTTP_GET_VARS['id'];

        pageheader($lang_delete_php['del_pic']);
        starttable("100%", $lang_delete_php['del_pic'], 7);
        output_table_header();
        $aid = delete_picture($pid);
        output_caption();
        echo "<tr><td colspan=\"7\" class=\"tablef\" align=\"center\">\n";
        echo "<div class=\"admin_menu_thumb\"><a href=\"thumbnails.php?album=$aid\"  class=\"adm_menu\">$lang_continue</a></div>\n";
        echo "</td></tr>\n";
        endtable();
        pagefooter();
        ob_end_flush();
        break;



do the same with this block
Code: [Select]
<tr>
<td class="tableh2"><b>Picture</b></td>
<td class="tableh2" align="center"><b>F</b></td>
<td class="tableh2" align="center"><b>N</b></td>
<td class="tableh2" align="center"><b>O</b></td>
<td class="tableh2" align="center"><b>T</b></td>
<td class="tableh2" align="center"><b>C</b></td>
<td class="tableh2" align="center"><b>D</b></td>
</tr>
<?php
}

function 
output_caption()
{
 
   global $lang_delete_php
    ?>

<tr><td colspan="7" class="tableb">&nbsp;</td></tr>
<tr><td colspan="7" class="tableh2"><b><?php echo $lang_delete_php['caption'?></b></tr>
<tr><td colspan="7" class="tableb">
<table cellpadding="1" cellspacing="0">
<tr><td><b>F</b></td><td>:</td><td><?php echo $lang_delete_php['fs_pic'?></td><td width="20">&nbsp;</td><td><img src="images/green.gif" border="0" width="12" height="12" align="absmiddle"></td><td>:</td><td><?php echo $lang_delete_php['del_success'?></td></tr>
<tr><td><b>N</b></td><td>:</td><td><?php echo $lang_delete_php['ns_pic'?></td><td width="20">&nbsp</td><td><img src="images/red.gif" border="0" width="12" height="12" align="absmiddle"></td><td>:</td><td><?php echo $lang_delete_php['err_del'?></td></tr>
<tr><td><b>O</b></td><td>:</td><td><?php echo $lang_delete_php['orig_pic'?></td></tr>
<tr><td><b>T</b></td><td>:</td><td><?php echo $lang_delete_php['thumb_pic'?></td></tr>
<tr><td><b>C</b></td><td>:</td><td><?php echo $lang_delete_php['comment'?></td></tr>
<tr><td><b>D</b></td><td>:</td><td><?php echo $lang_delete_php['im_in_alb'?></td></tr>
</table>
</td>
</tr>


in function delete_picture($pid) find line similar to the following and replace
Code: [Select]
     $files = array($dir . $file, $dir . $CONFIG['normal_pfx'] . $file, $dir . $CONFIG['thumb_pfx'] . $file, $dir . $CONFIG['orig_pfx'] . $file);
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on March 28, 2005, 04:18:56 pm
the rest is easy
rename or delete the file include/picmgmt.inc.php

and create a file include/picmgmt.inc.php that contains

Code: [Select]
<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.3.2                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002-2004 Gregory DEMAR                                     //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// (http://coppermine.sf.net/team/)                                          //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //
// CVS version: $Id: picmgmt.inc.php,v 1.8 2004/07/27 13:58:04 oddeveloper Exp $
// ------------------------------------------------------------------------- //

// Add a picture to an album
function add_picture($aid$filepath$filename$title ''$caption ''$keywords ''$user1 ''$user2 ''$user3 ''$user4 ''$category 0$raw_ip ''$hdr_ip '',$iwidth=0,$iheight=0)
{
    global $CONFIG$ERROR$USER_DATA$PIC_NEED_APPROVAL;
    global $lang_errors;

    $image $CONFIG['fullpath'] . $filepath $filename;
    $normal $CONFIG['fullpath'] . $filepath $CONFIG['normal_pfx'] . $filename;
    $thumb $CONFIG['fullpath'] . $filepath $CONFIG['thumb_pfx'] . $filename;
    $orig $CONFIG['fullpath'] . $filepath $CONFIG['orig_pfx'] . $filename;
$work_image $image;
    if (!is_known_filetype($image)) {
        return false;
    } elseif (is_image($filename)) {
if (!file_exists($orig) && $CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original'))  {
// if copy of full_sized doesn't exist and if watermark enabled and if fullsized pic watermark=true -> then we need a backup
if (!copy($image$orig))
                return false;
else
$work_image $orig;
}
        if (!file_exists($thumb)) {
            if (!resize_image($work_image$thumb$CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false"))
                return false;
        }
        $imagesize getimagesize($work_image);
        if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'] && !file_exists($normal)) {
            if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized'){
if (!resize_image($work_image$normal$CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "true"))
                 return false;
}
else {
if (!resize_image($work_image$normal$CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false"))
            return false;
}
}
/*else {
if (!resize_image($work_image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false"))
                return false;

}*/
        if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original'){
if (!resize_image($work_image$image$imagesize[0], $CONFIG['thumb_method'], 'orig''true'))
                 return false;
}
    } else {
        $imagesize[0] = $iwidth;
        $imagesize[1] = $iheight;
    }


    $image_filesize filesize($image);
    $total_filesize is_image($filename) ? ($image_filesize + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumb)) : ($image_filesize);


    // Test if disk quota exceeded
    if (!GALLERY_ADMIN_MODE && $USER_DATA['group_quota']) {
        $result db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']}{$CONFIG['TABLE_ALBUMS']} WHERE  {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND category = '" . (FIRST_USER_CAT USER_ID) . "'");
        $record mysql_fetch_array($result);
        $total_space_used $record[0];
        mysql_free_result($result);

        if ((($total_space_used $total_filesize)>>10) > $USER_DATA['group_quota'] ) {
            @unlink($image);
            if (is_image($image)) {
                @unlink($normal);
                @unlink($thumb);
            }
            $msg strtr($lang_errors['quota_exceeded'], array('[quota]' => ($USER_DATA['group_quota']),
                '[space]' => ($total_space_used >> 10)));
            cpg_die(ERROR$msg__FILE____LINE__);
        }
    }
    // Test if picture requires approval
    if (GALLERY_ADMIN_MODE) {
        $approved 'YES';
    } elseif (!$USER_DATA['priv_upl_need_approval'] && $category == FIRST_USER_CAT USER_ID) {
        $approved 'YES';
    } elseif (!$USER_DATA['pub_upl_need_approval']) {
        $approved 'YES';
    } else {
        $approved 'NO';
    }
    $PIC_NEED_APPROVAL = ($approved == 'NO');
    // User ID is now recorded when in admin mode (casper)
    $user_id USER_ID;
    $usernameUSER_NAME;
    $query "INSERT INTO {$CONFIG['TABLE_PICTURES']} (pid, aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip) VALUES ('', '$aid', '" addslashes($filepath) . "', '" addslashes($filename) . "', '$image_filesize', '$total_filesize', '{$imagesize[0]}', '{$imagesize[1]}', '" time() . "', '$user_id', '$username','$title', '$caption', '$keywords', '$approved', '$user1', '$user2', '$user3', '$user4', '$raw_ip', '$hdr_ip')";
    $result db_query($query);

    return $result;
}

define("GIS_GIF"1);
define("GIS_JPG"2);
define("GIS_PNG"3);

// Add 'edit' directory if it doesn't exist
// Set access to read+write only
if (!is_dir($CONFIG['fullpath'].'edit')) {
    $cpg_umask umask(0);
    @mkdir($CONFIG['fullpath'].'edit',0666);
    umask($cpg_umask);
    unset($cpg_umask);
}

/**
* resize_image()
*
* Create a file containing a resized image
*
* @param  $src_file the source file
* @param  $dest_file the destination file
* @param  $new_size the size of the square within which the new image must fit
* @param  $method the method used for image resizing
* @return 'true' in case of success
*/
function resize_image($src_file$dest_file$new_size$method$thumb_use$watermark="false")
{
    global $CONFIG$ERROR;
    global $lang_errors;

    $imginfo getimagesize($src_file);
    if ($imginfo == null)
        return false;
        // GD can only handle JPG & PNG images
    if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($method == 'gd1' || $method == 'gd2')) {
        $ERROR $lang_errors['gd_file_type_err'];
        return false;
    }
    // height/width
    $srcWidth $imginfo[0];
    $srcHeight $imginfo[1];
    if ($thumb_use == 'ht') {
        $ratio $srcHeight $new_size;
    } elseif ($thumb_use == 'wd') {
        $ratio $srcWidth $new_size;
    } else {
        $ratio max($srcWidth$srcHeight) / $new_size;
    }
    $ratio max($ratio1.0);
if ($thumb_use == 'orig'$ratio=1.0;
    $destWidth = (int)($srcWidth $ratio);
    $destHeight = (int)($srcHeight $ratio);
    // Method for thumbnails creation
    switch ($method) {
        case "im" :
            if (preg_match("#[A-Z]:|\\\\#Ai"__FILE__)) {
                // get the basedir, remove '/include'
                $cur_dir substr(dirname(__FILE__), 0, -8);
                $src_file '"' $cur_dir '\\' strtr($src_file'/''\\') . '"';
                $im_dest_file str_replace('%''%%', ('"' $cur_dir '\\' strtr($dest_file'/''\\') . '"'));
            } else {
                $src_file escapeshellarg($src_file);
                $im_dest_file str_replace('%''%%'escapeshellarg($dest_file));
            }

            $output = array();
$anno_txt="";
$annotate="";

            /*
             * Hack for working with ImageMagick on WIndows even if IM is installed in C:\Program Files.
             * By Aditya Mooley <aditya@sanisoft.com>
             */

                $cmd "{$CONFIG['impath']}convert -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} -geometry {$destWidth}x{$destHeight} $annotate $src_file $im_dest_file";
exec ($cmd$output$retval);
if ($watermark == "true"){
$cmd "{$CONFIG['impath']}composite -dissolve {$CONFIG['watermark_transparency']} -gravity {$CONFIG['where_put_watermark']} {$CONFIG['watermark_file']} $im_dest_file $im_dest_file";
exec ($cmd$output$retval);
             }

            if ($retval) {
                $ERROR "Error executing ImageMagick - Return value: $retval";
                if ($CONFIG['debug_mode']) {
                    // Re-execute the command with the backtit operator in order to get all outputs
                    // will not work is safe mode is enabled
                    $output = `$cmd 2>&1`;
                    $ERROR .= "<br /><br /><div align=\"left\">Cmd line : <br /><font size=\"2\">" nl2br(htmlspecialchars($cmd)) . "</font></div>";
                    $ERROR .= "<br /><br /><div align=\"left\">The convert program said:<br /><font size=\"2\">";
                    $ERROR .= nl2br(htmlspecialchars($output));
                    $ERROR .= "</font></div>";
                }
                @unlink($dest_file);
                return false;
            }
            break;

        case "gd1" :
            if (!function_exists('imagecreatefromjpeg')) {
                cpg_die(CRITICAL_ERROR'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed'__FILE____LINE__);
            }
            if ($imginfo[2] == GIS_JPG)
                $src_img imagecreatefromjpeg($src_file);
            else
                $src_img imagecreatefrompng($src_file);
            if (!$src_img) {
                $ERROR $lang_errors['invalid_image'];
                return false;
            }
            $dst_img imagecreate($destWidth$destHeight);
            imagecopyresized($dst_img$src_img0000$destWidth, (int)$destHeight$srcWidth$srcHeight);
            imagejpeg($dst_img$dest_file$CONFIG['jpeg_qual']);
            imagedestroy($src_img);
            imagedestroy($dst_img);
            break;

        case "gd2" :
            if (!function_exists('imagecreatefromjpeg')) {
                cpg_die(CRITICAL_ERROR'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed'__FILE____LINE__);
            }
            if (!function_exists('imagecreatetruecolor')) {
                cpg_die(CRITICAL_ERROR'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the config page'__FILE____LINE__);
            }
            if ($imginfo[2] == GIS_JPG)
                $src_img imagecreatefromjpeg($src_file);
            else
                $src_img imagecreatefrompng($src_file);
            if (!$src_img) {
                $ERROR $lang_errors['invalid_image'];
                return false;
            }
            $dst_img imagecreatetruecolor($destWidth$destHeight);
            imagecopyresampled($dst_img$src_img0000$destWidth, (int)$destHeight$srcWidth$srcHeight);
            
if ($watermark == "true"){
$logoImage ImageCreateFromPNG($CONFIG['watermark_file']); 
    $logoW ImageSX($logoImage); 
    $logoH ImageSY($logoImage); 
    //where is the watermark displayed... 
    $pos $CONFIG['where_put_watermark']; 
if ($pos == "northwest") { 
$src_x 5;  
$src_y 5
} else if ($pos == "northeast") { 
$src_x $destWidth - ($logoW 5); 
$src_y 5
} else if ($pos == "southwest") { 
$src_x 5
$src_y $destHeight - ($logoH 5); 
} else if ($pos == "southeast") { 
$src_x $destWidth - ($logoW 5); 
$src_y $destHeight - ($logoH 5); 
} else if ($pos == "center") { 
$src_x = ($destWidth/2) - ($logoW/2); 
$src_y = ($destHeight/2) - ($logoH/2); 


// no, we don't support that in the script, overkill... just make a transparentbkg png and don't be so lazy
//imagecolortransparent($logoImage, imagecolorat($logoImage, $CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery']));
imagealphablending($dst_imgTRUE);
imagecolortransparent($logoImageimagecolorat($logoImage$CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery']));
ImageCopyMerge($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH,$CONFIG['watermark_transparency']); //$dst_x,$dst_y,0,0,$logoW,$logoH); 
}
imagejpeg($dst_img$dest_file$CONFIG['jpeg_qual']);
            imagedestroy($src_img);
            imagedestroy($dst_img);
            break;
    }
    // Set mode of uploaded picture
    chmod($dest_fileoctdec($CONFIG['default_file_mode']));
    // We check that the image is valid
    $imginfo getimagesize($dest_file);
    if ($imginfo == null) {
        $ERROR $lang_errors['resize_failed'];
        @unlink($dest_file);
        return false;
    } else {
        return true;
    }
}
?>




That's it... have fun

bug fix: in editpics.php find
Code: [Select]
                        $files=array($dir.$file, $dir.$CONFIG['normal_pfx'].$file, $dir.$CONFIG['thumb_pfx'].$file);
replace with
Code: [Select]
                        $files=array($dir.$file, $dir.$CONFIG['normal_pfx'].$file, $dir.$CONFIG['thumb_pfx'].$file, $dir.$CONFIG['orig_pfx'].$file);

in searchnew
Code: [Select]
            if (strncmp($file, $CONFIG['thumb_pfx'], strlen($CONFIG['thumb_pfx'])) != 0 && strncmp($file, $CONFIG['normal_pfx'], strlen($CONFIG['normal_pfx'])) != 0 && $file != 'index.html')
with
Code: [Select]
            if (strncmp($file, $CONFIG['orig_pfx'], strlen($CONFIG['orig_pfx'])) != 0 && strncmp($file, $CONFIG['thumb_pfx'], strlen($CONFIG['thumb_pfx'])) != 0 && strncmp($file, $CONFIG['normal_pfx'], strlen($CONFIG['normal_pfx'])) != 0 && $file != 'index.html')
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 01:34:42 am
I'm going to try it right now.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 03:17:27 am
In Util.php...

ERROR creating:$thumb
ERROR creating:$normal
ERROR creating:$thumb
ERROR creating:$thumb
ERROR creating:$thumb
ERROR creating:$thumb

(w/ watermarking on)

When it's off, no problem.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 03, 2005, 09:16:27 am
In Util.php...

ERROR creating:$thumb
ERROR creating:$normal
ERROR creating:$thumb
ERROR creating:$thumb
ERROR creating:$thumb
ERROR creating:$thumb

(w/ watermarking on)

When it's off, no problem.

Can you upload single pictures with watermarking enabled.
Just with that info I can't tell you much... except that it usually means the system can't find the source file from where to create the files. It's a simple process. It checks if there's a copy of the uploaded full size image and if it's there it's using it, otherwise it takes the full sized image.

So open include/picmgmt.inc.php and insert
Code: [Select]
echo "Source: $src_file --- Destination: $dest_file<br>";
after
Code: [Select]
function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark)
{
    global $CONFIG, $ERROR;
    global $lang_errors;

then run it again. Now it'll tell you what file it's using as source and what file it's updating. Knowing that it shouldn't be a problem to fix it.

Oh, and I've forgotten to ask what you're using, GD2 or IM, *nix or win
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 06:39:05 pm
In Util.php...

ERROR creating:$thumb
ERROR creating:$normal
ERROR creating:$thumb
ERROR creating:$thumb
ERROR creating:$thumb
ERROR creating:$thumb

(w/ watermarking on)

When it's off, no problem.

Can you upload single pictures with watermarking enabled.
Just with that info I can't tell you much... except that it usually means the system can't find the source file from where to create the files. It's a simple process. It checks if there's a copy of the uploaded full size image and if it's there it's using it, otherwise it takes the full sized image.

So open include/picmgmt.inc.php and insert
Code: [Select]
echo "Source: $src_file --- Destination: $dest_file<br>";
after
Code: [Select]
function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark)
{
    global $CONFIG, $ERROR;
    global $lang_errors;

then run it again. Now it'll tell you what file it's using as source and what file it's updating. Knowing that it shouldn't be a problem to fix it.

Oh, and I've forgotten to ask what you're using, GD2 or IM, *nix or win

ImageMagick on Linux

And, no, I cannot upload single pictures with watermarking enabled.

I'm going to try what you said, and then report back.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 06:46:56 pm
Warning: Missing argument 6 for resize_image() in /home/gcfiasco/public_html/include/picmgmt.inc.php on line 134
Source: ./albums/edit/mHTTP_temp_2ac88500.jpg --- Destination: ./albums/edit/preview_14f1dd66.jpg
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 03, 2005, 07:28:59 pm
the error you got doesn't matter at all... but you can fix it with replacing the function resize_image line with

Code: [Select]
function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark="false")
or just copy/ paste picmgmt.inc.php from above. It's fixed there

when you've added the echo line I told you what does it spit out and do the images it tells you exist?? From most interest are the images orig_something.jpg (that's when you do the batch stuff)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 07:35:35 pm
Source: albums/userpics/10001/orig_108.jpg --- Destination: albums/userpics/10001/thumb_108.jpg
Source: albums/userpics/10001/orig_108.jpg --- Destination: albums/userpics/10001/normal_108.jpg
Source: albums/userpics/10001/orig_108.jpg --- Destination: albums/userpics/10001/108.jpg

Is that what you're looking for?

All those files exist...still no watermark.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 03, 2005, 08:22:45 pm
That all sounds pretty much OK :)
So my guess is that either the path to your watermark image is wrong or that it's a wrong format (I hope you use png... that's working perfect). But really, check the path, it has to be the absolute, full path to your watermark image

to check that add
Code: [Select]
if(!is_image($CONFIG['where_put_watermark'])) cpg_die(ERROR, "Watermark file not found or no image!!", __FILE__, __LINE__);
above (~line 180+ in picmgmt.inc.php)
Code: [Select]
$cmd = "{$CONFIG['impath']}composite -dissolve {$CONFIG['watermark_transparency']} -gravity {$CONFIG['where_put_watermark']} {$CONFIG['watermark_file']} $im_dest_file $im_dest_file";and run the batch tool

if this is not the problem check if the composite command can be executed
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 08:43:12 pm
"Watermark file not found or no image!!"

I have it set to "/images/watermark.png"...

I also tried "images/watermark.png" as well as "http://www.gcfiasco.com/images/watermark.png".
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Tranz on April 03, 2005, 09:09:11 pm
You might need the full absolute path. Ask your webhost for details.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 03, 2005, 09:09:32 pm
lol, OK, a long story for a simple mistake...
you need the absolute server path.. what you give it is the relative path

save that as eg docroot.php
Code: [Select]
<?php
echo $_SERVER['DOCUMENT_ROOT'];
?>

upload it and run it.. it tells you the absolute path to your document root. To that add your coppermine dir and the image dir + watermark filename

eg it spits out /usr/home/Yourname/sites/yoursite.com/htdocs
then add to that path eg /coppermine/images/watermark.png

so you get teh absolute pyth to your watermark image
/usr/home/Yourname/sites/yoursite.com/htdocs/coppermine/images/watermark.png
easy, huh

Have fun
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 09:50:39 pm
Changed to /home/gcfiasco/public_html/images/watermark.png, and it STILL gives me that same error. :(
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Nibbler on April 03, 2005, 09:53:28 pm
http://www.gcfiasco.com/images/watermark.png == 403 forbidden. CHMOD it so it is readable.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 03, 2005, 09:58:05 pm
http://www.gcfiasco.com/images/watermark.png == 403 forbidden. CHMOD it so it is readable.
That's odd...I can read it.  And it's CHMODed to 755.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 03, 2005, 10:19:39 pm
it'S strange.. but I have no clue how your box is setup. If it's a forbidden error you can try 777 too or you change the owner to www (usually php in in that group) and php maybe setup to not be able to read other group files (for security reasons, usually when your on a shared box).

Here I can't help you any further. That's nothing to do with the script but with server setup. You should ask your support or, as said chmod to 777 and chown to www (or in whatever group php may be)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 03, 2005, 10:21:44 pm
and it now doesn't die anymore with a wrong path to watermark image error?? (in batch tool)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 04, 2005, 01:32:55 am
and it now doesn't die anymore with a wrong path to watermark image error?? (in batch tool)
Nope.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 04, 2005, 08:56:22 am
then the pic's found but can't be accessed. That's server setup issues. If you're not afraid of commandline you probably can fix it yourself. A test if it's what I think is just to upload the watermark image through coppermine... then change the watermark path to the uploaded image.. test. If it's working then your host or you should chown the watermark pic.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 04, 2005, 11:01:25 pm
A test if it's what I think is just to upload the watermark image through coppermine... then change the watermark path to the uploaded image..
Also does not work.

Could an .htaccess file have anything to do with this?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 04, 2005, 11:17:15 pm
nope, the script is accessing the file directly, not using the webserver
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 04, 2005, 11:47:08 pm
Now that I've tested that, where should I go from here?

I'm having some major problems SSH'ing...
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 05, 2005, 10:15:06 am
you could tell me exactly what you do, what error message comes up. Enable debugging...
Is it an error that coppermine gives (embedded in coppermine layout) or is it different...

where and when and what does tell you 'forbidden'

no ssh is a pity too. I'll post some code later so that you can test IM and it's composite function.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 05, 2005, 07:13:49 pm
I do not get a forbidden error at all.

The only error message I experience is "No watermark..."

Notice: Undefined offset: 2 in /home/gcfiasco/public_html/upload.php on line 250

Notice: Undefined offset: 3 in /home/gcfiasco/public_html/upload.php on line 256

Notice: Undefined offset: 4 in /home/gcfiasco/public_html/upload.php on line 256

Notice: Undefined variable: file_failure_array in /home/gcfiasco/public_html/upload.php on line 1940

Notice: Undefined variable: URI_failure_array in /home/gcfiasco/public_html/upload.php on line 1941

Notice: Undefined variable: zip_failure_array in /home/gcfiasco/public_html/upload.php on line 1942

Watermark file not found or no image!!

File: /home/gcfiasco/public_html/include/picmgmt.inc.php - Line: 185

Notice: Undefined index: user1 in /home/gcfiasco/public_html/upload.php on line 2146

Notice: Undefined index: user2 in /home/gcfiasco/public_html/upload.php on line 2147

Notice: Undefined index: user3 in /home/gcfiasco/public_html/upload.php on line 2148

Notice: Undefined index: user4 in /home/gcfiasco/public_html/upload.php on line 2149

Notice: Undefined index: center in /home/gcfiasco/public_html/include/media.functions.inc.php on line 51

I will try to revert to a backed up upload.php, and then re-mod that.  I've had a feeling that I did something wrong in the coding from all along.  I should have just checked sooner.

Also, I read that watermark can be in the center, but this also warrants an error.  What do I need to set this as?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 05, 2005, 07:31:43 pm
something is definitely worng.. but it's not upload php. The modded files are delete.php (so that you can delete the backup files as well), util.php (same reason, that the backup files get included when doing batch stuff), picmgmt.inc.php (here's the watermark stuff, so when you upload, that file gets called... and when a pic gets resized then it'll get a watermark applied as well) and finally the english.php file. That's all.

So if upload spits out errors... not that good
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 06, 2005, 01:02:14 am
I'm just having so many problems for some reason.  Is there anyway you can send the files premoded?  Is that even allowed?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 06, 2005, 09:06:59 am
Why shouldn't it be allowed... but I've heavily modded my version. VBulletin style PM system, additional tags for the template, shoutbox, massmailer, lots of style changes, bunch of mysql additions and whatever
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 06, 2005, 01:52:12 pm
Yeah, then that will not work.

Maybe you can somehow simplify your directions?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 06, 2005, 04:48:37 pm
your lucky day... I've just seen that I still have my test version. Only the watermark mod's applied there. PM me your email addy if you want to have it
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 08, 2005, 01:18:37 am
I got your files...still doesn't work :(

Notice: Undefined index: wm_resized in /home/gcfiasco/public_html/config.php on line 411 (when I run config.php)

Notice: Undefined index: startpic in /home/gcfiasco/public_html/util.php on line 139 (when I run util.php)

...as well as the other errors I mentioned before..
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 08, 2005, 11:58:53 am
these errors don't mind... check it out on your local win box. It's working smooth there I bet... I've tested on two win machines, on FreeBSD and a Redhat box. Works everywhere. As said, I guess it's some weird permission/ group stuff your host's setup for security reasons. If you still haven't asked support you should do so.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 08, 2005, 07:14:27 pm
I don't even know if my ImageMagick is working correctly because I just set a Coppermine up on another account and it gave me a permission error.

I have ImageMagick enabled in the configuration, but how can I tell if I am actually using it?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 08, 2005, 07:44:27 pm
if ImageMagick is configured this will spit out all supported formats

Code: [Select]
<?php
exec 
("convert -list format"$return);
foreach(
$return as $out) { 
echo 
"$out<br>";
}
?>
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: lancefiasco on April 08, 2005, 08:50:09 pm
I contacted the host, who told me that the file was owned by my user name.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on April 12, 2005, 09:17:28 pm
I am having the same problems.....


I tried all the fixes mentioned in the previous posts and am still getting errors.

I am running cpg 1.3.2 bridged w/ phpbb 2.13 on an apache (I have shh access)

my watermark is a .png file (chmod 777) and can be found here (http://www.staticfiends.com/photos/images/watermark.png) and its path in config.php is: /home/staticp/public_html/photos/images/watermark.png

 :-\\

here is the error it sends me when I attempt to upload a single photo w/ the watermark

Quote
Watermark file not found or no image!!

File: /home/staticp/public_html/photos/include/picmgmt.inc.php - Line: 188



Notice: Undefined index: user1 in /home/staticp/public_html/photos/upload.php on line 2146

Notice: Undefined index: user2 in /home/staticp/public_html/photos/upload.php on line 2147

Notice: Undefined index: user3 in /home/staticp/public_html/photos/upload.php on line 2148

Notice: Undefined index: user4 in /home/staticp/public_html/photos/upload.php on line 2149
Source: albums/userpics/10004/orig_Picture1~1.jpg --- Destination: albums/userpics/10004/thumb_Picture1~1.jpg
Source: albums/userpics/10004/orig_Picture1~1.jpg --- Destination: albums/userpics/10004/normal_Picture1~1.jpg

Notice: Undefined index: bottomright in /home/staticp/public_html/photos/include/media.functions.inc.php on line 51



line 51 in media.functions.inc.php is:

Code: [Select]
   if (!is_null($filter) && $FILE_TYPES[$filename[$EOA]]['content']==$filter)


in case you need it, here is my debug info:

Code: [Select]
USER:
------------------
Array
(
    [ID] => 4e852da6faa5c227c3908eb58b711d41
    [am] => 1
    [liv] => Array
        (
            [0] => 4
            [1] => 13
            [2] => 7
            [3] => 18
            [4] => 19
        )

    [search] => assssss
)

==========================
USER DATA:
------------------
Array
(
    [0] => 4
    [user_id] => 4
    [1] => buffalo soulJAH
    [user_name] => buffalo soulJAH
    [2] => 1
    [user_level] => 1
    [groups] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 1761
            [3] => 7035
        )

    [group_quota] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [upload_form_config] => 3
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [custom_user_upload] => 0
    [disk_max] => 1024
    [disk_min] => 0
    [ufc_max] => 3
    [ufc_min] => 0
    [has_admin_access] => 1
    [group_name] => Administrators
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content FROM cpg132_filetypes;
    [1] => SELECT user_id, username as user_name, user_level FROM phpbb_sessions INNER JOIN phpbb_users ON session_user_id = user_id WHERE session_id='0d649a19bf69a3aed5ac368ac28ff960' AND session_user_id ='4' AND user_active='1'
    [2] => SELECT (ug.group_id + 5) as group_id FROM phpbb_user_group as ug LEFT JOIN phpbb_groups as g ON ug.group_id = g.group_id WHERE user_id = 4 AND user_pending = 0 AND group_single_user = 0
    [3] => 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 cpg132_usergroups WHERE group_id in (1,2,1761,7035)
    [4] => SELECT group_name FROM  cpg132_usergroups WHERE group_id= 1
    [5] => DELETE FROM cpg132_banned WHERE expiry < 1113332433
    [6] => SELECT * FROM cpg132_banned WHERE ip_addr='65.40.255.161' OR ip_addr='65.40.255.161' OR user_id=4
    [7] => SELECT category FROM cpg132_albums WHERE aid='1'
)

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

==========================
POST :
------------------
Array
(
    [album] => 1
    [title] => test
    [caption] => test
    [keywords] => test
    [control] => phase_2
    [unique_ID] => b9842480
)

==========================
VERSION INFO :
------------------
PHP version: 4.3.10 - OK
------------------
mySQL version: 4.0.22-standard
------------------
Coppermine version: 1.3.2
==========================
Module: gd
------------------
GD Support enabled
GD Version bundled (2.0.28 compatible)
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 3.23.49
MYSQL_MODULE_TYPE builtin
MYSQL_SOCKET /var/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 | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .:/usr/lib/php:/usr/local/lib/php | .:/usr/lib/php:/usr/local/lib/php
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 | 90 | 90
max_input_time | -1 | -1
upload_max_filesize | 25M | 25M
post_max_size | 100M | 100M
==========================
Page generated in 1.19 seconds - 8 queries in 0.004 seconds - Album set :


thanks in advance  8)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on April 12, 2005, 11:09:29 pm
search (http://forum.coppermine-gallery.net/index.php?action=search) the board for the error messages you get; they're not related to the watermarking hack. Please do not reply to this thread about the error you get, as the discussion would clutter this unrelated thread. Always make sure your install is working before applying a hack. Once you fixed those error messages and uploads are working as expected, re-apply this hack and turn to this thread if the hack itself doesn't work for you.

Joachim

sorry  :-[  it was working until I tried to get the watermark hack going....so I just figured that was the problem...thanks for your help.


the Watermark file not found or no image!! error is still there though
 
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Joachim Müller on April 14, 2005, 09:43:19 am
search (http://forum.coppermine-gallery.net/index.php?action=search) the board for the error messages you get; they're not related to the watermarking hack. Please do not reply to this thread about the error you get, as the discussion would clutter this unrelated thread. Always make sure your install is working before applying a hack. Once you fixed those error messages and uploads are working as expected, re-apply this hack and turn to this thread if the hack itself doesn't work for you.

Joachim
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: bangerkcknbck on April 16, 2005, 07:46:01 pm
Quote
so let's start

first the necessary SQL
Code:
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');

Okay so I guess I'm just not getting this..... I've figured out that I have to go into the /coppermine/sql folder and insert this into one of the files... but I'm not sure what one to modify (if it even matters).  I have the choice of basic, schema, and update sql files...

Anyone have an idea what one is supposed to get the code above?

Okay so I gave it a go figuring I've got a recent backup and nothing I can do but learn from this.

I updated basic.sql with the code from above and modified the rest of the files per this thread.  When I try to do a single picture upload I get these errors after placing it into an album:

Warning: imagesx(): supplied argument is not a valid Image resource in /usr/local/apache2/htdocs/Levanger/coppermine/include/picmgmt.inc.php on line 245

Warning: imagesy(): supplied argument is not a valid Image resource in /usr/local/apache2/htdocs/Levanger/coppermine/include/picmgmt.inc.php on line 246

Warning: imagecolorat(): supplied argument is not a valid Image resource in /usr/local/apache2/htdocs/Levanger/coppermine/include/picmgmt.inc.php on line 269

Warning: imagecolortransparent(): supplied argument is not a valid Image resource in /usr/local/apache2/htdocs/Levanger/coppermine/include/picmgmt.inc.php on line 269

Warning: imagecopymerge(): supplied argument is not a valid Image resource in /usr/local/apache2/htdocs/Levanger/coppermine/include/picmgmt.inc.php on line 270

In my coppermine config I'm set to
GD2
Watermark Yes
Center
Both
/images/watermark.png (I have also tried /usr/local/apache2/htdocs/Levanger/coppermine/images/watermark.png).

Any suggestions?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on April 17, 2005, 10:10:50 pm
you can use phpMyAdmin to do the sql stuff...just make sure that you insert the code into the right db and that you customize the code to fit your site path to the watermark.

let me know if you get it to work...because I still have the same problem that I listed above  :-\\
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 19, 2005, 05:16:44 pm
just adding the sql stuff to one of the files in your coppermine sql folder won't work. You'll have to either use commandline or phpmyadmin to add these to your current db config
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: bangerkcknbck on April 21, 2005, 09:16:40 am
freesouljah:
Thanks for your time to post a response.  I had already looked at the thread from Burpee where he noted to do the sql with phpmyadmin or webmin.  It then made sense.  I used webmin and  I did have to modify
Code: [Select]
cpg_configTo say what fit my database table like this:
Code: [Select]
cpg132_config
I now have the watermark setup working but never ran into the upload issues you have.  May I suggest trying with a vanilla install of CPG and a clean database then start the mods over?

Stramm:

Thank you very much for the time you spent to create this version and posting your thoughts on what I had to do to get it working.  I had already got it working and had stumbled into a few other issues.

I noticed one issue right away when I got it working and that was I couldn't get the watermark to move to a different spot in the picture.  It took some looking in the files I modified per your directions and your naming system to type into the config options isn't "bottomright" it is "southeast", "northwest" etc. (all lowercase no space and no quotes).

In the section for:
now open lang/english.php
find
$lang_config_php
and add
Code: [Select]
  'wm_bottomright' => 'Bottom right',
  'wm_bottomleft' => 'Bottom left',
  'wm_topleft' => 'Up left',
  'wm_topright' => 'Up Right',
  'wm_center' => 'Center',
  'wm_both' => 'Both',
  'wm_original' => 'Original',
I think you should have also included:
Code: [Select]
  'wm_resized' => 'resized',
as you have us modify that in the:
Code: [Select]
function form_watermark

I also noticed that my "O" when I deleted a file didn't have a definition it looked like this:
Code: [Select]
F : full size image
N : normal size image
O :
T : thumbnail
C : comment
D : image in album
So I found where I needed to update that and now it displays "Original in album".

But now I have a new issue thats got me stumped.  When I do a single file upload this mod works fine.  When I do a batch add files the resized photo gets the watermark but the original doesn't.  Did I miss something to make this work because I'm unable to figure out how to get it done.

I even created a test gallery and redid every mod exactly as you typed out without changing a single line and I still have the problem in my test gallery.

If you or anyone needs access to this gallery etc to help try to fix this, then  I'll be happy to provide you with whatever you you may need.

Thanks in advance


Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 21, 2005, 08:04:45 pm
sorry for the wm_bottomright thingie... there was a mixup with the GD only version. Don't change lang_config_php  but have another lang_config_data

Code: [Select]
'Image watermarking',
array('Watermark Image', 'enable_watermark', 1),
array('Where to place the watermark', 'where_put_watermark', 11),
array('Which files to watermark', 'which_files_to_watermark', 12),
array('Which file to use for watermark', 'watermark_file', 0),
array('Transparency 0-100 for entire image', 'watermark_transparency', 0),
array('Set color transparent x (GD2 only)', 'watermark_transparency_featherx', 0),
array('Set color transparent y (GD2 only)', 'watermark_transparency_feathery', 0),

Yes, I've forgotten the last line   'wm_resized' => 'resized',

both things fixed above as well as the typo in delete.php


OK, when you upload a pic (let's say mypicture.jpg) then you have three versions: normal_mypicture.jpg (has watermark), mypicture.jpg (has watermark and is the fullsize image) and orig_mypicture.jpg (no watermark cause that's the backup file in case you want to undo watermarking). This all should work perfect with normal upload, batch modify und batch upload... at least here it does ;)





Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: bangerkcknbck on April 21, 2005, 08:16:31 pm
Quote
K, when you upload a pic (let's say mypicture.jpg) then you have three versions: normal_mypicture.jpg (has watermark), mypicture.jpg (has watermark and is the fullsize image) and orig_mypicture.jpg (no watermark cause that's the backup file in case you want to undo watermarking). This all should work perfect with normal upload, batch modify und batch upload... at least here it does Wink
When I use "Upload file" it places the pictures in \userpics\10001 and I have 4 versions (everything from above and the thumb_ but thats not apart of this script and I understand that).  The mypicture.jpg is the original with the watermark, and has a modified date of the day I uploaded it.

When I do a batch add files I get the same 4 files, in the folder i ftp'd the original into, however it wasn't modified with the watermark.  So basically I have mypicture.jpg and i have orig_mypicture.jpg that are identical.  The script never watermarked mypicture.jpg.  mypicture.jpg still has the original file date when it was taken, not the date it was batched through like the 3 new files.


**Edit**
My pictures were not set to read/write.  I did a chmod 666 for each of the pictures and then did a batch upload and it worked peachy.

I would like to know if there is a way to make it so when I do a batch upload I don't get the broken picture links that are for the "DP" signs.  I would like them to show "OK" signs since they are uploading successfully, but that really is nitpicky I'm sure.

I did add one other thing to your script though for my own likes.

In picmgmt.inc.php I added this in the section where you are setting the cooridnates where the watermark will show up.
Code: [Select]
else if ($pos == "southcenter") {
$src_x = ($destWidth/2) - ($logoW/2);
$src_y = ($destHeight/2) - $logoH + 70;
}


The number 70 after $logoH slides the watermark down 70 pixels.  I prefer this over having a watermark right in the center as most head shot pictures would have the watermark right across the face.  Ofcourse you can change the number 70 to whatever suits your needs to move the watermark around.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 22, 2005, 08:55:49 am
does mypicture.jpg and orig_mypicture.jpg have a different file size?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: bloodynipples on April 23, 2005, 01:28:39 am
I am EXTREMELY frustrated. 

I have been trying to get my 1.2.1 upgraded to 1.3.3 all day long.  This was supposed to take 30 minutes this morning!!!!

I cannot seem to figure out what the problem is, but picmgmt.inc.php and upload.php don't seem to play nice once this watermarking hack is installed on version 1.3.3.  I will continue to beat on it, but for now, I am going to keep the old 1.3.2 version of picmgmt.inc.php to do the dirty work of watermarking. 

very, very, very frustrated.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 23, 2005, 10:44:04 am
picmgmt.inc.php are identical for 1.3.2 and 1.3.3 except one lil chmod thing. So just use the modified version on top.
If you want the lil change then search for
Code: [Select]
@mkdir($CONFIG['fullpath'].'edit',0666);and replace 0666 with 0777
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on April 27, 2005, 07:18:45 am
freesouljah:
Thanks for your time to post a response.  I had already looked at the thread from Burpee where he noted to do the sql with phpmyadmin or webmin.  It then made sense.  I used webmin and  I did have to modify
Code: [Select]
cpg_configTo say what fit my database table like this:
Code: [Select]
cpg132_config
I now have the watermark setup working but never ran into the upload issues you have.  May I suggest trying with a vanilla install of CPG and a clean database then start the mods over?



it may have something to do with the phpbb bridge....I will try it once more....and if I don't get it working, I will give it up and try a different watermark mod.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: cdrake on May 03, 2005, 12:26:30 am
Is it suppose to automatically watermark for batch upload only? because It doesnt add a watermark thats added through the regular upload process.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: bangerkcknbck on May 03, 2005, 08:03:20 am
Is it suppose to automatically watermark for batch upload only? because It doesnt add a watermark thats added through the regular upload process.

May I suggest reading post #44?  I could watermark on single picture upload, but had to chmod the files to 666 on batch.  Both processes work just fine.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Dice on June 13, 2005, 07:31:22 am
Just a Question with the mod....

Everything works fine.... but I have come across with one small problem.. it seems to not be watermaking the pics that dont need a resize

Like if I upload a pic that is larger than what it will show, it will resize it, and create the 4 files as mentioned in above posts.

But when you upload a pic that is not going to be resized as its smaller than the resize settings, it does not watermark
any of the pics and the "normal_mypicture.jpg" is missing completely. Only "mypicture.jpg" and "orig_mypicture.jpg"
are uploaded into the folder (as well as the thumb). The "mypicture.jpg" does not get watermarked at all....

As I said it works fine for when you upload an oversized picture, but not for non resized pictures.

Anyhelp would be appreciated to maybe a slolution for this prob. Thanks is advance.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on June 13, 2005, 10:33:45 am
But when you upload a pic that is not going to be resized as its smaller than the resize settings, it does not watermark
any of the pics and the "normal_mypicture.jpg" is missing completely.

uhps... sorry
It's fixed now. Please update your picmgmt.inc.php
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on June 13, 2005, 10:35:53 am
and I've written a lil addition for batch changes so you won't have to click for each bunch the submit button. With a few thousand images that'll need ages. Now it's 'auto pressing' it and you just run the batch process and leave it running till it's finished. If anyone needs it...
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Dice on June 13, 2005, 01:54:50 pm
uhps... sorry
It's fixed now. Please update your picmgmt.inc.php

Thanks so much Stramm, you fixed that so quick....
Works perfectly now....

Big thanks to all the work that you have put into this mod....  ;D

Title: Re: Permanent Watermark with GD2 mod mod
Post by: rcsmith on June 21, 2005, 07:08:39 pm
now delete.php

find a block similar to the one below and replace (just colspan has been adjusted)
Code: [Select]
    // Picture

    case 'picture':
        if (!(GALLERY_ADMIN_MODE || USER_ADMIN_MODE)) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

        $pid = (int)$HTTP_GET_VARS['id'];

        pageheader($lang_delete_php['del_pic']);
        starttable("100%", $lang_delete_php['del_pic'], 7);
        output_table_header();
        $aid = delete_picture($pid);
        output_caption();
        echo "<tr><td colspan=\"7\" class=\"tablef\" align=\"center\">\n";
        echo "<div class=\"admin_menu_thumb\"><a href=\"thumbnails.php?album=$aid\"  class=\"adm_menu\">$lang_continue</a></div>\n";
        echo "</td></tr>\n";
        endtable();
        pagefooter();
        ob_end_flush();
        break;



do the same with this block
Code: [Select]
<tr>
<td class="tableh2"><b>Picture</b></td>
<td class="tableh2" align="center"><b>F</b></td>
<td class="tableh2" align="center"><b>N</b></td>
<td class="tableh2" align="center"><b>O</b></td>
<td class="tableh2" align="center"><b>T</b></td>
<td class="tableh2" align="center"><b>C</b></td>
<td class="tableh2" align="center"><b>D</b></td>
</tr>
<?php
}

function 
output_caption()
{
    global 
$lang_delete_php
    ?>

<tr><td colspan="7" class="tableb">&nbsp;</td></tr>
<tr><td colspan="7" class="tableh2"><b><?php echo $lang_delete_php['caption'?></b></tr>
<tr><td colspan="7" class="tableb">
<table cellpadding="1" cellspacing="0">
<tr><td><b>F</b></td><td>:</td><td><?php echo $lang_delete_php['fs_pic'?></td><td width="20">&nbsp;</td><td><img src="images/green.gif" border="0" width="12" height="12" align="absmiddle"></td><td>:</td><td><?php echo $lang_delete_php['del_success'?></td></tr>
<tr><td><b>N</b></td><td>:</td><td><?php echo $lang_delete_php['ns_pic'?></td><td width="20">&nbsp</td><td><img src="images/red.gif" border="0" width="12" height="12" align="absmiddle"></td><td>:</td><td><?php echo $lang_delete_php['err_del'?></td></tr>
<tr><td><b>O</b></td><td>:</td><td><?php echo $lang_delete_php['orig_pic'?></td></tr>
<tr><td><b>T</b></td><td>:</td><td><?php echo $lang_delete_php['thumb_pic'?></td></tr>
<tr><td><b>C</b></td><td>:</td><td><?php echo $lang_delete_php['comment'?></td></tr>
<tr><td><b>D</b></td><td>:</td><td><?php echo $lang_delete_php['im_in_alb'?></td></tr>
</table>
</td>
</tr>




I don't quite understand this.  You use the same code twice in delete.php??  or do you replace the 2nd code with the one on this page?
Title: Re: Permanent Watermark with GD2 mod mod
Post by: Stramm on June 22, 2005, 08:54:12 am
I don't quite understand this.  You use the same code twice in delete.php??  or do you replace the 2nd code with the one on this page?

have a look at the first code block... now look for a similar one in delete.php and replace the found one with the one shown here. When done look at the second code block, find something similar in delete.php and replace with the given one here. As said, only lil changes here in the table layout to have two more cells.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: djmac on June 23, 2005, 07:37:15 am
Stramm

The mod you have posted. Is that MOD complete? Is it a MOD without typos, missing lines and so forth? I ask this because I have installed your mod and I get no errors what so ever. But it doesn't add the watermark either. I have tried it under imagemagick, and GD2. I am running CPG133. I have read every message in this database about your MOD and I can't find anything that might help. Pleeeeeeease Help me or I'm going into the garage and find a beam.

BTW Great work. You have obviously put a lot of effort in to this MOD.

Regards
Don
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on June 23, 2005, 08:44:18 am
Have you added the SQL? And you've entered the absolute path to the wm image?

When modifying the config and you check after saving it... this works?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: djmac on June 23, 2005, 04:35:47 pm
Stramm

Yes, I added the SQL, used the complete server path and the information saves in the config. Let me through this in the mix. My SQL prefix is djmac200_config. I also tried Burpee's MOD first and that didn't work either. Then I seen your MOD and felt it would better suit my needs. Let me know if you need to get into it and I will PM you with anything you need.

Regards
Don
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on June 23, 2005, 08:13:18 pm
to me it looks like you haven't added the mysql statements correctly... a wrong absolute path would spit out an error after uploading and not show the pic at all. A problem with the mysql would just upload the pic without watermark... ;)

I dunno how you added the mysql stuff... but something went wrong (that's my guess)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: djmac on June 24, 2005, 12:34:02 am
Stramm

OK That is a possibility. What I did was create a txt file with the parameters and installed the tables that way. It looked like it setup correctly. I will take out the tables and re-install them again. But this time I will do it one at a time. I'll let you know how I make out.

Thanks

and Regards
Don
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: djmac on June 24, 2005, 01:40:24 am
Stramm

OK I got it! It works.... I knew it was something so obvious if it had teeth it would have bit me. In the config under Transparency 0-100 for entire image I had 0, zip, nadda... Sometimes you have to smack me to get my attention.....

Thank you for your patience and your time.

Regards
Don
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on June 24, 2005, 08:38:35 am
uhhmm.. OK... I should have said to use something like 50 to test it, hahaha
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: -TRshady- on June 28, 2005, 10:59:29 am
Hey there Stramm, first off thanks for the great mod .. am running into problems though and after 2 days still can't get around it.

Would you mind reading This Thread (http://forum.coppermine-gallery.net/index.php?topic=19212.0) and possibly offering a solution?

Much thanks.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on June 28, 2005, 12:19:32 pm
With the duplicates I can't help you. That's related to coppermine itself. I even didn't know coppermine shows duplicates (shame about me). I just know it renames files if the same filename's already present.

For the watermarking... have you set 'Which files to watermark' to => both??

When you use the 'Tools', you can recreate fullsized and normal pics... does that work?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: dezibel on July 10, 2005, 09:48:39 pm
Hi!
Just applied the hack, but util.php gives me this:
Code: [Select]
Warning: chmod(): Operation not permitted in /var/www/test/bilder/include/picmgmt.inc.php on line 281
albums/userpics/10001/thumb_100_1303.jpg oppdateringen var vellykket!
albums/userpics/10001/normal_100_1303.jpgoppdateringen var vellykket!

Warning: chmod(): Operation not permitted in /var/www/test/bilder/include/picmgmt.inc.php on line 281
albums/userpics/10001/thumb_100_1299.jpg oppdateringen var vellykket!
albums/userpics/10001/normal_100_1299.jpgoppdateringen var vellykket!

Warning: chmod(): Operation not permitted in /var/www/test/bilder/include/picmgmt.inc.php on line 281
albums/userpics/10001/thumb_100_1298.jpg oppdateringen var vellykket!
albums/userpics/10001/normal_100_1298.jpgoppdateringen var vellykket!

Warning: chmod(): Operation not permitted in /var/www/test/bilder/include/picmgmt.inc.php on line 281
albums/userpics/10001/thumb_100_1297.jpg oppdateringen var vellykket!
albums/userpics/10001/normal_100_1297.jpgoppdateringen var vellykket!

singlefile upload gives no error, but again, it does not get the watermark. What can this be?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 11, 2005, 09:18:33 am
looks like chmod for files isn't set properly in your coppermine config. 666 should work for most environments.

To fix the permissions of the already uploaded pics SSH into your box go to your cpg/albums/userpics/10001 directory and type

chmod -R 666 *
(you may need root access to do that)
if you have other directories in userpics like 10002 do the same in there as well

It works when uploading new pics cause then no file exists. Later, in the batch tool coppermine tries to change the pics but your OS doesn't allow coppermine to do so. Therefore the 'operation not permitted'


Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MKnet on July 12, 2005, 07:20:37 am
I tried this hack and everything "seemed" to work fine. BUT the image quality was horrible. I am not sure exactly why. If you want to see an example go here:
http://michellekwan.net/gallery/thumbnails.php?album=1

I tried messing around with the settings and nothing really helped. FYI, all the images were clear and clean before upload. I uploaded two of the same picture. One with the hack install, one after I took it off.  It is obviously compressing the photos (600k vs 100k). I don't WANT it too. Seemed like it was a "feature" by the creator but I have more bandwidth then I could ever use so I could careless about saving it. Is there a way to disable it?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 12, 2005, 08:58:44 am
adding a watermark means applying an image to your existing one and processing/ recompressing the entire newly created image again. If your base material is from minor quality or already compressed to the limit you'll get bad results. That should be clear to everyone.

The hack uses the settings in your config. So you can try to raise image quality there to avoid more compression. Or you switch to another image manipulation tool... IMagick instead of GD2 or vice versa. I think it was IMagick that needed two steps to create a watermarked image versus one step with GD2.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MKnet on July 12, 2005, 11:13:40 am
Config was set to 100. I tried both GD2 and IM. Do have an example site where this actually working well?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 12, 2005, 07:39:56 pm
I have a live site up but it's adult... here a test pic. A fishtank I've sold on ebay. Pic downloaded from ebay, you still can see their watermark. Mine is in the center, jpg quality 80, IM, transparency 40
Watermark: Arial bold, font color blue, outline 1px gray
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 13, 2005, 08:11:24 am
I finally got around to re-installing this sweet mod...and it worked this time  ;D


one thing that could be useful in later versions would be an option to use the watermark or not while uploading.....not a complaint, but a suggestion....

thanks again  8)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 13, 2005, 08:52:18 am
one thing that could be useful in later versions would be an option to use the watermark or not while uploading.....

So that each uploader (guest, registered, admin) can disable watermarking for his own uploads?? What for should that be?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 14, 2005, 02:06:31 am
one thing that could be useful in later versions would be an option to use the watermark or not while uploading.....

So that each uploader (guest, registered, admin) can disable watermarking for his own uploads?? What for should that be?

Mainly Admin...at least in my case.  In my galleries, I have images that were taken by me and other photogs exclusively for our site...and that is when I would want to use the watermark (most likely in batch add).  But then the rest of the galleries are user contributions, which I don't want to add the watermark to.  So at the moment, when I want to use the watermark, I turn it on in Admin....do a batch add...and then shut it off again.

Thanks
Title: hack: admin can disable watermarking with checkbox in standard upload
Post by: Stramm on July 14, 2005, 12:39:40 pm
it's easy to do... but I haven't tested it that's your job, heheh

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 14, 2005, 08:23:53 pm
that's your job, heheh



that it is  ;)

I will let you know how it goes...


Thanks again  ;D
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 15, 2005, 10:07:30 pm
I get this error  ???

Quote
Parse error: parse error, unexpected T_IF, expecting ')' in /home/staticp/public_html/photos/upload.php on line 925


line 925 is:

      
Code: [Select]
if (USER_IS_ADMIN) {
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 16, 2005, 08:39:16 am
change the line above to

Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1));
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 19, 2005, 04:26:39 am
now it says:

Quote
Parse error: parse error, unexpected T_IF in /home/staticp/public_html/photos/upload.php on line 925
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 19, 2005, 09:08:58 am
OK, lol...just for you I've installed this modmod on my test machine....

it's one lil mistake. Happened cause I'm already using a modded upload php

so here you go... find in upload php

Code: [Select]
   $form_array = array(
    array($lang_upload_php['album'], 'album', 2),
    array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
    array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
    array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
    array('control', 'phase_2', 4),
    array('unique_ID', $_POST['unique_ID'], 4),
    );

replace with

Code: [Select]
   $form_array = array(
    array($lang_upload_php['album'], 'album', 2),
    array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
    array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
    array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
    array('control', 'phase_2', 4),
    array('unique_ID', $_POST['unique_ID'], 4),
    );

if (USER_IS_ADMIN) {
$form_array[] = array($lang_upload_php['disable_admin_watermark'], 'disable_admin_watermark', 5);
}

I've corrected this above as well
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: xb00t on July 21, 2005, 02:53:24 pm
Your method works like a charm! Everything is OK and I am quite pleased with the result. ;)

Only one question. Can I apply the watermark to the already uploaded pictures?  ::)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 21, 2005, 06:34:11 pm
Your method works like a charm! Everything is OK and I am quite pleased with the result. ;)

Only one question. Can I apply the watermark to the already uploaded pictures?  ::)

yes... try the admin tools -> Update thumbs and/or resized photos -> Both normal and full sized (if a orig copy is available)
the standard coppermine function isn't that good if you have loads of pics. If you do have more then ~500 tell me and I'll post my batch modify mod
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: xb00t on July 21, 2005, 11:45:35 pm
It seems to be working pretty fine except the fact that for some reason I cant change the CHMOD to some of my pics and CPG can't update them. It works works for some of them. @_@ The wierdest thing is that my FTP client wont change the CHMOD aswel. And I am root. ???
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Joachim Müller on July 22, 2005, 08:28:22 am
if you're root, you should know: CHOWN before CHMODing...
However, the root account shouldn't be used for FTPing.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 22, 2005, 09:28:17 am
However, the root account shouldn't be used for FTPing.

for security reasons you should go even further and configure root not to be able to login using ftp, ssh, ssh2 or whatever. Most secure is to use a standard user to login and then su. This way an attacker will need to break two walls

And some FTP clients have problems with chown, chmod. Use ssh, that works
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Ancyru on July 23, 2005, 11:09:47 am
There seems to be an issue with having watermarks on Resized images only. I have added this mod to an unmodified coppermine 1.3.3

It works fine if I select watermarks for both images but no watermark appears for just resized images. Any suggestions?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Ancyru on July 23, 2005, 03:23:47 pm
Also when I select the option to watermark the originals only it watermarks the resized and original image.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 24, 2005, 08:55:30 am
you're right... thanks for mentioning it. Looks like with the last bugfix a few if statements mixed up

just replace your picmgmt.inc.php with the new one
Title: hack: different watermark for users
Post by: Stramm on July 24, 2005, 10:31:42 am
That's a lil hack for the watermark mod. If you want certain users to have their own watermark then it's for you

How to use it?
Just FTP a new watermark file into the dir where your main watermark file already is. It's name should be the username it is for. On nix boxes it's case sensitive. It has to be png.
Eg. the user you want to have an own watermark for is 'MadDog'... then the watermark file needs to be named 'MadDog.png'. When this user now uploads, that watermark will be used for his pictures. Pictures uploaded by other users will get the standard watremark. To remove special watermarks for a certain user, just delete his watermark file.

Warning: when using the admin tools to change/ modify watermarks all special watermarks will get replaced with the standard watermark. If the logged in admin has a special watermark this will be used then.

here's the new picmgmt.inc.php

Code: [Select]
<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.3.2                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002-2004 Gregory DEMAR                                     //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// (http://coppermine.sf.net/team/)                                          //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //
// CVS version: $Id: picmgmt.inc.php,v 1.8 2004/07/27 13:58:04 oddeveloper Exp $
// ------------------------------------------------------------------------- //

// Add a picture to an album
function add_picture($aid$filepath$filename$title ''$caption ''$keywords ''$user1 ''$user2 ''$user3 ''$user4 ''$category 0$raw_ip ''$hdr_ip '',$iwidth=0,$iheight=0)
{
    global 
$CONFIG$ERROR$USER_DATA$PIC_NEED_APPROVAL;
    global 
$lang_errors;

    
$image $CONFIG['fullpath'] . $filepath $filename;
    
$normal $CONFIG['fullpath'] . $filepath $CONFIG['normal_pfx'] . $filename;
    
$thumb $CONFIG['fullpath'] . $filepath $CONFIG['thumb_pfx'] . $filename;
    
$orig $CONFIG['fullpath'] . $filepath $CONFIG['orig_pfx'] . $filename;
$work_image $image;
    if (!
is_known_filetype($image)) {
        return 
false;
    } elseif (
is_image($filename)) {
if (!file_exists($orig) && $CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original'))  {
// if copy of full_sized doesn't exist and if watermark enabled and if fullsized pic watermark=true -> then we need a backup
if (!copy($image$orig))
                return 
false;
else
$work_image $orig;
}
        if (!
file_exists($thumb)) {
            if (!
resize_image($work_image$thumb$CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false"))
                return 
false;
        }
        
$imagesize getimagesize($work_image);
        if (
max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'] && !file_exists($normal)) {
            if (
$CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized'){
if (!resize_image($work_image$normal$CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "true"))
                
return false;
}
else {
if (!resize_image($work_image$normal$CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false"))
            return 
false;
}
}
/*else {
if (!resize_image($work_image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false"))
                return false;

}*/
        
$imagesize getimagesize($work_image);
        if (
$CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original'){
if (!resize_image($work_image$image$imagesize[0], $CONFIG['thumb_method'], 'orig''true'))
                
return false;
}
    } else {
        
$imagesize[0] = $iwidth;
        
$imagesize[1] = $iheight;
    }


    
$image_filesize filesize($image);
    
$total_filesize is_image($filename) ? ($image_filesize + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumb)) : ($image_filesize);


    
// Test if disk quota exceeded
    
if (!GALLERY_ADMIN_MODE && $USER_DATA['group_quota']) {
        
$result db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']}{$CONFIG['TABLE_ALBUMS']} WHERE  {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND category = '" . (FIRST_USER_CAT USER_ID) . "'");
        
$record mysql_fetch_array($result);
        
$total_space_used $record[0];
        
mysql_free_result($result);

        if (((
$total_space_used $total_filesize)>>10) > $USER_DATA['group_quota'] ) {
            @
unlink($image);
            if (
is_image($image)) {
                @
unlink($normal);
                @
unlink($thumb);
            }
            
$msg strtr($lang_errors['quota_exceeded'], array('[quota]' => ($USER_DATA['group_quota']),
                
'[space]' => ($total_space_used >> 10)));
            
cpg_die(ERROR$msg__FILE____LINE__);
        }
    }
    
// Test if picture requires approval
    
if (GALLERY_ADMIN_MODE) {
        
$approved 'YES';
    } elseif (!
$USER_DATA['priv_upl_need_approval'] && $category == FIRST_USER_CAT USER_ID) {
        
$approved 'YES';
    } elseif (!
$USER_DATA['pub_upl_need_approval']) {
        
$approved 'YES';
    } else {
        
$approved 'NO';
    }
    
$PIC_NEED_APPROVAL = ($approved == 'NO');
    
// User ID is now recorded when in admin mode (casper)
    
$user_id USER_ID;
    
$usernameUSER_NAME;
    
$query "INSERT INTO {$CONFIG['TABLE_PICTURES']} (pid, aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip) VALUES ('', '$aid', '" addslashes($filepath) . "', '" addslashes($filename) . "', '$image_filesize', '$total_filesize', '{$imagesize[0]}', '{$imagesize[1]}', '" time() . "', '$user_id', '$username','$title', '$caption', '$keywords', '$approved', '$user1', '$user2', '$user3', '$user4', '$raw_ip', '$hdr_ip')";
    
$result db_query($query);

    return 
$result;
}

define("GIS_GIF"1);
define("GIS_JPG"2);
define("GIS_PNG"3);

// Add 'edit' directory if it doesn't exist
// Set access to read+write only
if (!is_dir($CONFIG['fullpath'].'edit')) {
    
$cpg_umask umask(0);
    @
mkdir($CONFIG['fullpath'].'edit',0666);
    
umask($cpg_umask);
    unset(
$cpg_umask);
}

/**
* resize_image()
*
* Create a file containing a resized image
*
* @param  $src_file the source file
* @param  $dest_file the destination file
* @param  $new_size the size of the square within which the new image must fit
* @param  $method the method used for image resizing
* @return 'true' in case of success
*/
function resize_image($src_file$dest_file$new_size$method$thumb_use$watermark="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 && $imginfo[2] != GIS_PNG && ($method == 'gd1' || $method == 'gd2')) {
        
$ERROR $lang_errors['gd_file_type_err'];
        return 
false;
    }
    
// height/width
    
$srcWidth $imginfo[0];
    
$srcHeight $imginfo[1];
    if (
$thumb_use == 'ht') {
        
$ratio $srcHeight $new_size;
    } elseif (
$thumb_use == 'wd') {
        
$ratio $srcWidth $new_size;
    } else {
        
$ratio max($srcWidth$srcHeight) / $new_size;
    }
    
$ratio max($ratio1.0);
if ($thumb_use == 'orig'$ratio=1.0;
    
$destWidth = (int)($srcWidth $ratio);
    
$destHeight = (int)($srcHeight $ratio);
    
// Method for thumbnails creation
    
switch ($method) {
        case 
"im" :
            if (
preg_match("#[A-Z]:|\\\\#Ai"__FILE__)) {
                
// get the basedir, remove '/include'
                
$cur_dir substr(dirname(__FILE__), 0, -8);
                
$src_file '"' $cur_dir '\\' strtr($src_file'/''\\') . '"';
                
$im_dest_file str_replace('%''%%', ('"' $cur_dir '\\' strtr($dest_file'/''\\') . '"'));
            } else {
                
$src_file escapeshellarg($src_file);
                
$im_dest_file str_replace('%''%%'escapeshellarg($dest_file));
            }

            
$output = array();
$anno_txt="";
$annotate="";

            
/*
             * Hack for working with ImageMagick on WIndows even if IM is installed in C:\Program Files.
             * By Aditya Mooley <aditya@sanisoft.com>
             */

                
$cmd "{$CONFIG['impath']}convert -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} -geometry {$destWidth}x{$destHeight} $annotate $src_file $im_dest_file";
exec ($cmd$output$retval);
if ($watermark == "true"){
$cmd "{$CONFIG['impath']}composite -dissolve {$CONFIG['watermark_transparency']} -gravity {$CONFIG['where_put_watermark']} {$wm_file} $im_dest_file $im_dest_file";
exec ($cmd$output$retval);
            
}

            if (
$retval) {
                
$ERROR "Error executing ImageMagick - Return value: $retval";
                if (
$CONFIG['debug_mode']) {
                    
// Re-execute the command with the backtit operator in order to get all outputs
                    // will not work is safe mode is enabled
                    
$output = `$cmd 2>&1`;
                    
$ERROR .= "<br /><br /><div align=\"left\">Cmd line : <br /><font size=\"2\">" nl2br(htmlspecialchars($cmd)) . "</font></div>";
                    
$ERROR .= "<br /><br /><div align=\"left\">The convert program said:<br /><font size=\"2\">";
                    
$ERROR .= nl2br(htmlspecialchars($output));
                    
$ERROR .= "</font></div>";
                }
                @
unlink($dest_file);
                return 
false;
            }
            break;

        case 
"gd1" :
            if (!
function_exists('imagecreatefromjpeg')) {
                
cpg_die(CRITICAL_ERROR'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed'__FILE____LINE__);
            }
            if (
$imginfo[2] == GIS_JPG)
                
$src_img imagecreatefromjpeg($src_file);
            else
                
$src_img imagecreatefrompng($src_file);
            if (!
$src_img) {
                
$ERROR $lang_errors['invalid_image'];
                return 
false;
            }
            
$dst_img imagecreate($destWidth$destHeight);
            
imagecopyresized($dst_img$src_img0000$destWidth, (int)$destHeight$srcWidth$srcHeight);
            
imagejpeg($dst_img$dest_file$CONFIG['jpeg_qual']);
            
imagedestroy($src_img);
            
imagedestroy($dst_img);
            break;

        case 
"gd2" :
            if (!
function_exists('imagecreatefromjpeg')) {
                
cpg_die(CRITICAL_ERROR'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed'__FILE____LINE__);
            }
            if (!
function_exists('imagecreatetruecolor')) {
                
cpg_die(CRITICAL_ERROR'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the config page'__FILE____LINE__);
            }
            if (
$imginfo[2] == GIS_JPG)
                
$src_img imagecreatefromjpeg($src_file);
            else
                
$src_img imagecreatefrompng($src_file);
            if (!
$src_img) {
                
$ERROR $lang_errors['invalid_image'];
                return 
false;
            }
            
$dst_img imagecreatetruecolor($destWidth$destHeight);
            
imagecopyresampled($dst_img$src_img0000$destWidth, (int)$destHeight$srcWidth$srcHeight);
            
if ($watermark == "true"){
$logoImage ImageCreateFromPNG($wm_file);
    $logoW ImageSX($logoImage); 
    $logoH ImageSY($logoImage); 
    //where is the watermark displayed...
    $pos $CONFIG['where_put_watermark']; 
if ($pos == "northwest") { 
$src_x 5;  
$src_y 5
} else if ($pos == "northeast") { 
$src_x $destWidth - ($logoW 5); 
$src_y 5
} else if ($pos == "southwest") { 
$src_x 5
$src_y $destHeight - ($logoH 5); 
} else if ($pos == "southeast") { 
$src_x $destWidth - ($logoW 5); 
$src_y $destHeight - ($logoH 5); 
} else if ($pos == "center") { 
$src_x = ($destWidth/2) - ($logoW/2); 
$src_y = ($destHeight/2) - ($logoH/2); 


// no, we don't support that in the script, overkill... just make a transparentbkg png and don't be so lazy
//imagecolortransparent($logoImage, imagecolorat($logoImage, $CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery']));
imagealphablending($dst_imgTRUE);
imagecolortransparent($logoImageimagecolorat($logoImage$CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery']));
ImageCopyMerge($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH,$CONFIG['watermark_transparency']); //$dst_x,$dst_y,0,0,$logoW,$logoH); 
}
imagejpeg($dst_img$dest_file$CONFIG['jpeg_qual']);
            
imagedestroy($src_img);
            
imagedestroy($dst_img);
            break;
    }
    
// Set mode of uploaded picture
    
chmod($dest_fileoctdec($CONFIG['default_file_mode']));
    
// We check that the image is valid
    
$imginfo getimagesize($dest_file);
    if (
$imginfo == null) {
        
$ERROR $lang_errors['resize_failed'];
        @
unlink($dest_file);
        return 
false;
    } else {
        return 
true;
    }
}
?>
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Ancyru on July 24, 2005, 11:20:05 am
I have updated the new picmgmt.inc.php but it still isn't applying the watermark to the resized images on the resize only option.

[ edit | actually the new picmgmt.inc.php has made no difference ]
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 24, 2005, 11:47:15 am
tested again with only resized, only original, both and no watermark... works perfect. you really are using the actual version??
(I've used the version from the board to be sure it's the one it should be). In case it really doesn't work, attach your picmgm... and tell me something about your system
Title: hack: better admin tool update thumbs, normal, full pictures
Post by: Stramm on July 24, 2005, 11:59:00 am
When having a lot of pics the standard admin tools are a pain. On production boxes with a short timeout you only can process ~5 pics at a time. When done you have to click 'continue'. Doing that for a few thousand pics is annoying as hell. So here a lil hack for it.

What it does... the script simply calls itself over and over again till all images are processed. No need to click continue. Best is to set ~5 images to process at a time. If it really should time out with these only five pics just hit the browser reload button and it continues to work. So have a coffe and a lil bit of time and all's done by itself...

in util.php find
Code: [Select]
<form action="' . $phpself . '" method="post">
replace with
Code: [Select]
<form action="updatethumbs.php" method="post">
a few lines below find
Code: [Select]
   endtable();

    print '<br />';

replace with
Code: [Select]
endtable();

print '<h2>'.$lang_util_php['select_album'].'</h2>';

    if (defined('UDB_INTEGRATION')) {
        udb_util_filloptions();
    } else {
        filloptions();
    }



    print '<br />

<form action="' . $phpself . '" method="post">';


now place the attached file in your coppermine main dir

Have fun drinking your coffee
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Ancyru on July 24, 2005, 12:42:00 pm
The picmgmt.inc.php is exactly the same as the one you just updated.

I forgot to mention that it's working fine on the files I just upload but it's not working in admin tools to update images.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 24, 2005, 02:12:30 pm
you should have mentioned that before :)

OK, either update 'function updatethumbs()' or apply the better admin tool hack for updating thumbs, normal and full images

if you stumble over some more bugs... you know where I am, hehehe

edit: I'm using the above mentioned hack... so I wasn't able to test the standard function. But the hack works smooth for me
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Ancyru on July 24, 2005, 02:16:31 pm
Sweet, everything is working fine now!

Cheers mate,
` anCyru
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 31, 2005, 06:18:49 am
OK, lol...just for you I've installed this modmod on my test machine....

it's one lil mistake. Happened cause I'm already using a modded upload php

so here you go... find in upload php

Code: [Select]
    $form_array = array(
    array($lang_upload_php['album'], 'album', 2),
    array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
    array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
    array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
    array('control', 'phase_2', 4),
    array('unique_ID', $_POST['unique_ID'], 4),
    );

replace with

Code: [Select]
    $form_array = array(
    array($lang_upload_php['album'], 'album', 2),
    array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
    array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
    array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
    array('control', 'phase_2', 4),
    array('unique_ID', $_POST['unique_ID'], 4),
    );

if (USER_IS_ADMIN) {
$form_array[] = array($lang_upload_php['disable_admin_watermark'], 'disable_admin_watermark', 5);
}

I've corrected this above as well




I get this error now:

Quote
Parse error: parse error, unexpected ',' in /home/staticp/public_html/photos/upload.php on line 923

this may be due to a mod that I have installed in that area...
here is what I have:

Code: [Select]
        // Declare an array containing the various upload form box definitions.
        $captionLabel = $lang_upload_php['description'];
        if ($CONFIG['show_bbcode_help']) {$captionLabel .= '<hr />'.$lang_bbcode_help;}
        $form_array = array(
        sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
        array($lang_upload_php['album'], 'album', 2),
        array('MAX_FILE_SIZE', $max_file_size, 4),
        array($lang_upload_php['picture'], 'userpicture', 1, 1),
        array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
        array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
        array($lang_upload_php['keywords'], 'keywords', 0, 255, 1));
        array('event', 'picture', 4),                                                        <----------------- line 923

if (USER_IS_ADMIN) {
$form_array[] = array($lang_upload_php['disable_admin_watermark'], 'disable_admin_watermark', 5);
}

        );


sorry for all the trouble  ???

also...I have noticed that sometimes the quality of the original image is crummy (it appears that the normal sized version has just been stretched out and then watermarked at a larger size)...this doesn't always happens, so I don't know if it is because of server load or what...


thanks
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 31, 2005, 09:56:34 am
change
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1));to
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
with the ); at the end you're closing the array definition but continue in the next line with it
then as it looks that will just correct the error message you have now. Another one will show up.

The code should read...
Code: [Select]
        array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
        array('event', 'picture', 4));

if (USER_IS_ADMIN) {
$form_array[] = array($lang_upload_php['disable_admin_watermark'], 'disable_admin_watermark', 5);
}


the pic quality stuff that sometimes happens. It's the downside of having to recompress the images. Hasn't to do anything with the load. But if you want you can email me a pic (original for sure) and I'll have a look

But I really can't give you support with other mods
The above stuff's just obvious ;)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 31, 2005, 04:10:19 pm
change
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1));to
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
with the ); at the end you're closing the array definition but continue in the next line with it
then as it looks that will just correct the error message you have now. Another one will show up.

The code should read...
Code: [Select]
        array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
        array('event', 'picture', 4));

if (USER_IS_ADMIN) {
$form_array[] = array($lang_upload_php['disable_admin_watermark'], 'disable_admin_watermark', 5);
}


the pic quality stuff that sometimes happens. It's the downside of having to recompress the images. Hasn't to do anything with the load. But if you want you can email me a pic (original for sure) and I'll have a look

But I really can't give you support with other mods
The above stuff's just obvious ;)

cool  8)

that fixed the problem....thanks :D

on the image problem it seems to not be a problem in small batches...so for now I will use the util to fix the quality issues...but if you still want to see the image quality probs, I can post up examples for you...


on your util.php mod I get this error when I try to process the images:

Quote
Parse error: parse error, unexpected $ in /home/staticp/public_html/photos/updatethumbs.php on line 160
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 31, 2005, 04:23:48 pm
 ???

it seems the image quality issue isn't as predictable as I thought....I just did a batch of over 100 images, and they all seemed to turn out fine...but when I went through using util.php to try to fix the issues on another batch that had the image degredation, nothing happened...

here are two pics showing the problem I am encountering:
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 31, 2005, 04:26:09 pm
that is strange...the original should be 700 px tall (not 524)...that is why they appear to be 'stretched out'...they actually are  ???
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 31, 2005, 04:57:59 pm
I'll have a look what maybe go wrong there.

To the updatethumbs.php problem... it's the board's code tag that caused the problem. I've added another linebreak that should fix the prob (related to EOT). Just repace the updatethumbs.php file
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 31, 2005, 05:24:33 pm
To the updatethumbs.php problem... it's the board's code tag that caused the problem. I've added another linebreak that should fix the prob (related to EOT). Just repace the updatethumbs.php file

cool..excellent work  ;D  makes it much easier...

thanks
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on July 31, 2005, 07:37:14 pm
I had a look at your pic and experimented a lil bit with it. The standard function to calculate the resize ratio won't work properly under some circumstances. That's fixed now. You'll have to update picmgmt and updatethumbs... the messed up ones can be fixed with the admin tool
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on July 31, 2005, 09:04:00 pm
now the util.php gives me a blank page when I try to update thumbs...


I finally saw what the other admin modification you made for me does...and unfortunately, it is not quite what I was hoping for.  Rather than an option for the admin to disable the watermark...I was hoping that it might be automatically disabled for anybody but the admin (or need the admin to turn it on while in batch add)...

if this is a problem...don't worry about it, its not that big of a deal...

thanks
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on August 01, 2005, 08:38:43 am
to revert the functionality is easy... watermarking permanently off and only admin can turn it on while uploading

for now it works watermark on and admin can disable watermarking while uploding

I'll attach the updatethumbs file above to avoid board problems with the code tag again
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: freesouljah on August 06, 2005, 11:19:32 pm
working smooth as butter  8)


thanks once again...
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: rcsmith on August 08, 2005, 06:21:34 pm
How do you make it so it never backs up any files?  I have so many albums I can't get into the admin tool because my mysql will hit 100% and kill the server.  I'd like to just disable the backup process.

thanks!
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on August 08, 2005, 06:52:13 pm
the backup of the file doesn't have anything to do with your mysql load. You just need ~30% more HD space as your orig image consumes. That's it.

to remove the backup delete in picmgmnt.inc.php  (not tested... !!!!)

Code: [Select]
if (!file_exists($orig) && $CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original'))  {
// if copy of full_sized doesn't exist and if watermark enabled and if fullsized pic watermark=true -> then we need a backup
if (!copy($image, $orig))
                return false;
else
$work_image = $orig;
}

something similar you'll find in util.php as well.. delete it too (that's for batch add). However I don't recommend it... maybe if you're running low on HD space. But the load is no reason at all.. and to copy once an image as backup while uploading doesn't need much resources as well. Compared to the image processing it's maybe <1%
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: rcsmith on August 08, 2005, 07:13:12 pm
thank you i'll give this a try.  My server only has 3% left so that's probably a problem too.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mylogon on August 30, 2005, 03:33:59 am
I have installed the mod and have a couple of questions/problems:

Quote
- admin can disable watermarking whilst upload (checkbox added to upload form)
  Which upload form?  Not in single, not in batch (I really wish batch would someday work  :\'( for more than a couple of images  -or work all the time - not when it feels like it) and I do not see an option in the Xp wizard.

Quote
So in Admin Tools just use 'Update thumbs and/or resized photos' to apply or remove watermarks
Where is the choice to remove?  Do you just set the option to no watermark in config?

I do see where to remove all backups, just not the undo

It does watermark - so I know it is working but only for the main image - not the thumbnail and I do have 'Both" set.  It does not do it in uploading or admin tools.  Admin tools I have "Both thumbnails and resized pictures" set.  It also does not do thumbnails when I have it set to only update thumbnails.

Linux - same results with both GD and Imagemagic.  I even renamed updatethumbs and reinserted it just to try that.)

Does this not do thumbnails?

(Does anyone have a patch file for this entire setup?  That sure would be a whole lot easier then trying to figure out what and where things go  -just a little confusing at first and second read....  (I was going make a patch file, but not working correctly enough to do so yet :-[))

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on August 30, 2005, 08:56:10 am
Quote
- admin can disable watermarking whilst upload (checkbox added to upload form)
this is an additional mod. With it the admin has the possibility whilst uploading to decide not to watermark certain images. It is not part of the base mod

Quote
Where is the choice to remove?  Do you just set the option to no watermark in config?
I haven't invented the admin tools. So it's a good idea to have a look in the manual. The admin tools just recreate images/ thumbs based on the config settings.

Quote
It does watermark - so I know it is working but only for the main image

answer is in the first post:
Quote
Which files to watermark - normal sized, full sized or both
Why would one want to watermark thumbnails???

The instructions in the first two posts are complete. However there are functionality hacks that aren't useful for the maiority of users (like the disabling watermarking for admin whilst upload, different watermarks for users and bettr admin tools). This additions you can find in the thread.

If you really need thumbnail watermarking and you have very basic php knowledge then you can do some copy/paste programming to adapt picmgmnt.inc.php to your needs
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mylogon on August 30, 2005, 09:23:47 am
I thought you were saying that the restore was part of your admin tools.  Thumnails are stolen just as much as regualr pics - even would be more so if they are not watermarked - that's why I was looking for it.  Probably better that the restore it is not in the admin tools.  It makes it harder for someone to accidentally restore them.

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on August 30, 2005, 09:35:20 am
there is a restore. Usually when you watermark an image you can't undo the watermark. If something wents wrong or your watermark just sucks, you once want to have a different sized intermediate pic... bad luck, you can't undo the changes. This mod makes a backup of the original image. So if you turn off watermarking in config and rebuild normal and fullsized pics then they won't have watermarks anymore. You can apply a new one... sure, no problem at all. If you think you don't need the backup cause all's to your likings... then you can delete them and noone has a chance to catch your backups.

As said, you can enhance the mod to watermark thumbnails too. I just think it looks disgusting and don't use that.
Yes, you should protect your work. Therefore I've written this mod. But you can do to much as well. If you annoy your visitors to much (with the ugly view of watermarked thumbs) I believe they pretty much will avoid your site.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mylogon on August 30, 2005, 09:45:37 am
Now I understand the restoring of the original images.  That is what I was asking.  The thumbnails - well a client asked.  they are night club promoters and people  swipe their images to put on MySpace.com  -as a thumbnail size.  They load of their home page with pictures of them.   That why he asked.

Maybe I will look at the changing that.  Have you thought of posting a patch file to do all of the manual changes in the part that you have written?  I can send one to you  - as I made an entire backup before I started as I knew I would end up setting up multiple galleries and did not want to do all that hand work again.

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on August 30, 2005, 09:58:41 am
No, I don't have files here anymore with just the changes for the watermark mod, sorry

Problem with the thumb watermarking can be the watermark size. If chosen to big it can take up the entire thumb size. So you may want to check if you watermark a thumb or a normal/ fullsized Image. If it's a thumb then resize the watermark image before applying it.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mylogon on August 30, 2005, 10:51:49 am
I do have the patch file if you want it.  (I did your mod before any of the other ones on a clean install - so I know it is clean.)

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 01, 2005, 08:58:26 am
If it's 1.34.. then it'll be very nice if you send me the files. Will make an install version for all my mods
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mylogon on September 01, 2005, 11:15:24 am
I should have it for 1.34 soon.  I use Fantastico and they have not updated to 1.34 yet.  Soon, I hope....

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 11:18:28 am
hey I installed your hack
but when I update it in configuration
that watermark will be enabled
it doesnt really update it
and returns to set on "no" instead "yes"
like I didnt even changed it
whats the problem?
please help me
also when I go to util.php
it gives me this:
Parse error: parse error, unexpected T_LNUMBER in /home/healthnfit/domains/healthnfit.org/public_html/cpg132/util.php on line 481
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 11:31:57 am
looks to me like as if you haven't applied the sql or you did it wrong... have you changed the table prefix to the one you use??
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 11:35:13 am
what you mean
I did do the query thing in sql...

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');

ohh I think I know the problem
in watermarkfile
I need to use the url to the file?
what do you mean full path?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 11:43:42 am
well I did it right now
but its not updating the pics with the watermark
they are still without watermark
what to do?

fixed the error in util.php
but still not working
what it can be?
is it the png file?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 12:02:47 pm
I mean if you have changed the prefix cpg_ to the one you use.

The absolute path eg on windows is c:\apache\mysite.com\htdocs\cpg\images\mywatermark.png
on nix eg. /usr/home/stramm/mysite.com/htdocs/cpg/images/mywatermark.png

if you don't give it the absolute URL it (imagemagick, gd2) can't find the watermark image and therefore of course won't apply it
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 12:13:52 pm
I will search for my absolute path
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 12:26:34 pm
when I try to add it with my absolute path
it gives me this error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/home/healthnfit/domains/healthnfit.org/public_html/cpg132/watermark.png');
ins' at line 1
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 12:30:20 pm
as already mentioned above... you have a problem with your SQL. I've asked you if you've changed the prefix (cpg_) to the one you actually use?

so eg. change this
insert into cpg_config (name, value) values ('enable_watermark', '1');
to (if your prefix eg. is cpg134_)
insert into cpg134_config (name, value) values ('enable_watermark', '1');
or (if your prefix eg. is coppermine_)
insert into coppermine_config (name, value) values ('enable_watermark', '1');

edit: and what 'error' did you fix in util.php?? If you haven't applied the sql correctly nothing will work. But if you really found an error what about posting it here?



Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 12:42:29 pm
ok fixed the problems
but still not putting the watermark
I did change the prefix and absolute path
this is what I put in sql
insert into cpg132_config (name, value) values ('enable_watermark', '1');
insert into cpg132_config (name, value) values ('where_put_watermark', 'bottomright');
insert into cpg132_config (name, value) values ('watermark_file', '/home/healthnfit/domains/healthnfit.org/public_html/cpg132/watermark.png');
insert into cpg132_config (name, value) values ('which_files_to_watermark', 'both');
insert into cpg132_config (name, value) values ('orig_pfx', 'orig_');
insert into cpg132_config (name, value) values ('watermark_transparency', '0');
insert into cpg132_config (name, value) values ('watermark_transparency_featherx', '0');
insert into cpg132_config (name, value) values ('watermark_transparency_feathery', '0');

do I need to change anything in the cpg admin configuration of the watermark?
also about the util I just didnt edit it right but fixed it
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 12:44:49 pm
set the watermark transparency to 100 (means off) or at least to 30-50 to see the watermarked image. Now it's fully transparent
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 12:48:44 pm
still cant see it
whats the pixels of the watermark png file needs to be?
maybe its too "big" or something like this?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 01:31:20 pm
the wm size shouldn't matter at all... pm me your URL if you want. A temporary cpg admin account would be useful
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 01:50:29 pm
check your pm box
thanks again
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 03:31:02 pm
I just noticed that its working
but only on new uploads
how can I make all the old pics that are already in the gallery to have the watermark?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 03:59:40 pm
nevermind thanks
fixed it all
thank you again!
but some pics it ruins the pic quality
how can I fix it?
it pixelizing them??!?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 04:20:06 pm
yes, it only works on new pics.. to watermark old ones you'll have to use the admin tools.

Adding watermarks means that you'll have to compress your images a second time. This means you'll lose image detail. You won't see any difference if you use good quality source files. But if you laready have highly compressed base material this can lead to problems.

If you send me a URL I'll have a look. Best would be if you could send me the original file before watermarking
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 04:30:16 pm

how can I remove the watermark
and get back to the orginial pics
your script ruins the quality of the pics but really ruins them
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 04:34:32 pm
Quote
If you send me a URL I'll have a look. Best would be if you could send me the original file before watermarking

The watermark script doesn't resize anything but it has to attach the watermark and therefore needs to recompress the image. Read the Imagick documentation to learn more about this.

You can try to raise image quality in your settings.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 04:38:25 pm
nm
how can I get back to the originial pics without watermarks?
can you tell me please how
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 04:39:38 pm
OK, you never say what you do... you don't send me a link that I can check the stuff, you don't send me an image to have a look at and you don't read the coppermine documentation nor have you read the first two posts of this thread...

I still guess you messed something up when applying the mod... however this way I cant help you.

To undo the watermark use the admin tools as you did to watermark your old pictures
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 04:45:00 pm
ok thanks I can give you here original pic that it ruined it
heres good example:
http://www.healthnfit.org/cpg132/albums/userpics/normal_kobi17.jpg
this picture was ruined (pixelized)
dont know why
it has good quality on it
btw this is the original pic
without watermark
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 04:52:33 pm
btw I already sent you admin access in pm!
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 04:56:25 pm
This is not the orig but the normal file (already highly compressed to 17k)... still it doesn't matter and it looks sweet after watermarking.

Have a look yourself (14k after watermarking, I always use image quality 80%)
http://stramm.mine.nu/displayimage.php?pos=-102

A word to your manners. I really like to help. But it's disgusting to get abused as one's personal php advisor. If you tell me you have problems then I need some infos. With these infos I can tell you in most cases where the problem is. Now it's your turn to say if that helped you to solve your problem and what finally was the problem. This probably can help others and I won't have to answer the same stuff again and again.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 04:56:57 pm
btw I already sent you admin access in pm!

this was a 404
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 05:00:28 pm
sent you the access again
and how in yours cpg it didnt turn the quality to crap
can you tell me how?

and I installed the script succesfully you can see for yourself
its just give me some
Warning: chmod(): Operation not permitted
when I change the pics in the admin tools
but it says it changes it successfully
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 05:23:04 pm
I couldn't test it... looks like you have already removed the watermark sql entries. So it's not possible for me to enable and/ or change watermark related settings

the watermark mod works perfect once you've installed it properly.
And I've even tested your image again with the picmgmnt.inc.php from this thread... still working smooth as butter.

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 05:25:36 pm
yes it does work perfect on some pics
but some of them it doesnt work good

just wanted to know did it delete the watermark pics
or I need to delete them manually with ftp?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 02, 2005, 05:32:28 pm
you said you ran the admin tools to watermark them all and later again to remove the watermarks... If you now open an image within coppemine and you don't see a watermark anymore then it probably got removed.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: genom on September 02, 2005, 06:02:36 pm
ok I will do more experiments in the next few days with this watermark
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: scrich on September 04, 2005, 04:14:52 pm
Hello, i'm new here in the forums and i've got a problem whith this mod:

I've done all that you said in the first page and I don't get any error, but my watermark doesn't appear. It's with the full, real, path, but when I do the admin tools, it doesn't appear in any image. Which could be the problem?

Thanks.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 04, 2005, 04:19:13 pm
the transparency setting probably... raise it to ~40-50. 0 means there is no watermark overlay over the picture
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: scrich on September 04, 2005, 04:29:50 pm
the transparency setting probably... raise it to ~40-50. 0 means there is no watermark overlay over the picture
I tried with 70 and nothing...  :\'(
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 04, 2005, 04:39:03 pm
the standard problems are
- not properly updated sql (when you change settings and reopen config the just modified stuff doesn't show anymore)
- wrong path to the watermark image (realative or webpath instead of absolute path)
- the mentioned transparency
- picmgmnt.inc.php placed in cpg main dir instead of include

does it watermark when you do a normal upload? If so then check the changes you did in util.php again. Please report back
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: scrich on September 04, 2005, 04:43:58 pm
Got it!  :D The problem was i have picmgmnt.inc.php in cpg main instead of include. Thank you very much.

Now, another problem. I use a png watermark, but the in the photo is showed like this:
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fencancha.com%2Fcpg%2Falbums%2Fuserpics%2F10001%2FIS5P1268.jpg&hash=1c7a223100bd49d2fca5b58c935a74de8e3c23de)
Can i solve it?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 04, 2005, 06:20:34 pm
there are a lot of possibilities to fix that
1. use IMagick
1. only use one of the transparency features at a time (only transparent background or transparency against the image background)... not nice, I know
3. Make the background not transparent in the wm image but eg. white. Then use Set color transparent x,y and point it to a white point in your watermark (usually x,y = 1 should do). If you've set this, then GD2 will make all white pixels transparent. Still there's a backdraw, it doesn't look to pretty
4. The best solution is to make the image background transparant as you did. Then set layer transparency of the watermark to ~30-40. Save as png24 with transparency. Now the image transparency in config doesn't have a function anymore. You control it just with the layer transparency in your paint proggy.
now find in picmgmnt.inc.php
Code: [Select]
ImageCopyMerge($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH,$CONFIG['watermark_transparency']); //$dst_x,$dst_y,0,0,$logoW,$logoH);and replace with
Code: [Select]
ImageCopy($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH);
If I'm not mistaken then this problem only occurs with newer php versions
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: scrich on September 04, 2005, 06:37:29 pm
Great!!  :D It's solved:
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fencancha.com%2Fcpg%2Falbums%2Fuserpics%2F10001%2FIS5P1268.jpg&hash=1c7a223100bd49d2fca5b58c935a74de8e3c23de)
I did what you said in 4th place and it worked perfectly. Thank you very much  :)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: u-n-i on September 13, 2005, 10:34:24 am
Quote
4. The best solution is to make the image background transparant as you did. Then set layer transparency of the watermark to ~30-40. Save as png24 with transparency. Now the image transparency in config doesn't have a function anymore. You control it just with the layer transparency in your paint proggy.
now find in picmgmnt.inc.php


worked for me too

thanks mate
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: u-n-i on September 13, 2005, 10:41:15 am
a suggestion

it wud be good if this can be added

option to choose the wm position (top/bottom/bottom right etc.) at upload place
so we can change position if wm color is same as of pic color at already specified position



hope to see this one very soon :)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: finnerss on September 14, 2005, 03:08:23 am
Hi there, this sounds like a marvelous mod,  the only thing I  have as a problem is I always get mixed up with the steps and all, and since we're releasing the website to the public soon, the watermarks would be very useful but I'm not very good when it comes to changing code and all. I haven't added any mod to my coppermine 1.3 version (I installed 1.4beta but not using it right now). Any chance the files could be set in a pack to simply replace the files? I can give you the full information you might need or just let me know what settings would I need to set in order to just get the modified files, upload to the proper folders, and replace those files that were changed.

This would be very appreciated and I know it might be a lot of work, I will give you full credit at the site for the watermarks and try to look for an option to show our appreciation and thanks.

Best wishes

Sergio

sergio@bustamante.as is my e-mail, it might be easier this way but I'll keep on checking this thread. :)

Sergio
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 14, 2005, 08:34:50 am
check the 2nd post in this thread
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: clubvibe on September 19, 2005, 08:28:09 pm
I just modded my CPG with stramm's modpack and it's working great except for the watermarking. on a single upload the watermarking isn't a problem, but it doens't work on a batch upload. Isn't this mod able to watermark batch uploads? or am I making a mistake?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 20, 2005, 08:41:18 am
batch uploads shouldn't be a problem... you made a mistake I assume

edit... just to show you... I batch added 10 pics here http://localhost/cpg132/thumbnails.php?album=44
all works excellent (watermark, thumb cropping, thumb sharpening, fullsized resize)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on September 20, 2005, 10:45:34 pm
Stamm,

you wrote: - "possibility to assign different watermarks to certain users" ???

Could yu tell more about it? and how to find this in code?

I would like to add about 15 watermarks because I have 15 people whos have a access to my gallery and each of them must be own watermark, and I wonder how to make this? how to declare 15 watermarks? I would like to choose watermark under popup during uploading image, is it possiblle? I saw only one watermark in your example/course and what about more watermarks in the same gallery?


Regards,
Pawel
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: artistsinhawaii on September 20, 2005, 10:48:58 pm
batch uploads shouldn't be a problem... you made a mistake I assume

edit... just to show you... I batch added 10 pics here http://localhost/cpg132/thumbnails.php?album=44
all works excellent (watermark, thumb cropping, thumb sharpening, fullsized resize)

Hi Stramm,

:-)  Your link doesn't look right. 
Maybe you meant:  http://stramm.mine.nu/thumbnails.php?album=44  ?


Dennis
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 21, 2005, 07:45:43 am
Hi Stramm,

:-)  Your link doesn't look right. 
Maybe you meant:  http://stramm.mine.nu/thumbnails.php?album=44  ?


Dennis

;) you're absolutely right
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on September 21, 2005, 08:36:49 am
I use GD2, that my additional information for the previous question, which I don't still know how to make a few watermarks. I would like to have choosing under uploading images e.g. on the popup. I neeb about 15 watermarks for 15 person ( each person should have individual watermark)


Regards,
Pawel
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 21, 2005, 08:47:23 am
Ho pgrzegorc, have you alreday read that? Replace picmmnt.inc.php with the provided one. Upload a 'main' watermark file. This has two functions. a) it provides the path to the watermark files and b) it's the fallback
Now just upload png images with the same names like the users you want to have their own watermarks. Eg. Stramm... my watermark file would be Stramm.png
Upload it in the same directory as your fallback watermark file

http://forum.coppermine-gallery.net/index.php?topic=16286.msg92232#msg92232
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: clubvibe on September 23, 2005, 01:23:47 pm
i installed stramm's 'allready edited' files. the only file i didn't replace is theme.php. So i figured this was the problem for thebatch upload pictures. I also installed theme.php but it stil doesn 't work. What could be the problem? I'm sure i copied ALL files now.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 24, 2005, 08:34:44 am
theme.php doesn't matter at all.
I'll need more info if I should help you. Does uploading a single file work and does it get the watermarked...

have you checked the standard errors
http://forum.coppermine-gallery.net/index.php?topic=16286.msg98081#msg98081
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Zeitgeist on September 25, 2005, 06:21:24 am
Is this on the fly, or does it permantely mark the image file with a watermark? I'm using the old ImageMagick one and it does it on the fly so the original files aren't modified.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 25, 2005, 09:18:58 am
Is this on the fly, or does it permantely mark the image file with a watermark? I'm using the old ImageMagick one and it does it on the fly so the original files aren't modified.

Have you at least read the thread's subject? If that attracts your attention maybe post 1 in this thread tells you more about it's contents
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: clubvibe on September 25, 2005, 09:52:01 pm
theme.php doesn't matter at all.
I'll need more info if I should help you. Does uploading a single file work and does it get the watermarked...

have you checked the standard errors
http://forum.coppermine-gallery.net/index.php?topic=16286.msg98081#msg98081

I read the errors and checked them.. all seem to be OK.
Single upload works perfect. It resizes and puts a watermark on the pictures.
Batch upload doesn't resize (it displays it propperly at the good dimension, but originals are still the old dimensions and size) and it doesn't put a watermark on the pictures... strange isn't it?

My picture edit also doesn't seem to work after your patch....
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 26, 2005, 08:06:51 am
as said... I can't help you if you don't come up with some error messages.

Again I've tried. This time to edit pictures... again it works smooth
rotated the thumb/intertmediate/full 180%

http://stramm.mine.nu/cpg132/thumbnails.php?album=44 (the first thumb ;) )

And cause the mod didn't modify the batch or pic edit stuff but simply integrates into the resize function... it works in every environment as soon as it works for the normal upload. If then there are strange problem you have made some royal mistake. But again.. I can't say anything if I even don't get error messages
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: clubvibe on September 26, 2005, 01:57:55 pm
The picture editor was my mistake.. i solved that one.

As for the batch upload. I don't get any errors. Everything works smooth, except for adding the watermark and real resizing of the files.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on September 26, 2005, 07:27:34 pm
k, I'm sure there's some error on your end... whatever... if you want you can PM me for my email addy and then send me a zip of your coppermine base dir, include (winthout config.inc.php), lang
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: joker on October 06, 2005, 12:07:58 pm
Is there a way that I can change the order the script works?

I would like the steps like:
Upload -> Backup -> Watermark -> Resize -> Save

That way I can create a watermark that is the approximate size of my average image and when it displays the thumbnail the watermark is not larger than the pic.

Most of my images are 1280x853 or greater.  If I make a 600x80 watermark then when it watermarks the thumbnail it is wider than the image.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 06, 2005, 01:00:45 pm
sure, you'll have to modify picmgmnt.inc.php -> function add_picture()

but why would you want to do it? Creating a huge watermark and then resizing it? Makes no sense. Just make it fit on your normal images and then they automatically fit on your fullsized ones
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: joker on October 06, 2005, 05:18:12 pm
The only reason I want to do it is if the thumbnail watermark coves most of the pic its harder to edit the watermark out and use the picture.
I have uploaded some picks and the watermark falls completely in a solid colored area and is very easy to edit out.

If the watermark takes up most of the width of the image it makes it more difficult to re-touch.

Thanks for the info...
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 06, 2005, 05:29:16 pm
What I've said above.... just make your watermark smaller so it fits on your normal images.  And there are no thumbnail watermarks. Thumbs stay without them
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: joker on October 06, 2005, 11:33:46 pm
Sorry...I was referring to the intermediate image.  Thanks for all your support.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 13, 2005, 04:26:45 pm
sorry if this is a repost its really difficult to find the problem im looking for but, i installed the cpg1.35 and used the mod pack. Everything installed fine but when i get to the section actually upload the pictures it doesnt do anything but just keeps loading, basically once i click continue the page just stays loading and doesnt go to the next page. It stays stuck on the upload.php. Do you know what this problem could be?

Thanks
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 13, 2005, 05:25:28 pm
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)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 14, 2005, 12:05:18 am
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.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: 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.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 14, 2005, 03:35:42 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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on October 15, 2005, 12:31:32 pm
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

This mod is based on the 'Permanent Watermark with GD2 mod (http://forum.coppermine-gallery.net/index.php?topic=7160.0)'.
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
Code: [Select]
//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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 15, 2005, 12:56:21 pm
have you read this?
http://forum.coppermine-gallery.net/index.php?topic=16286.msg92232#msg92232

If you've more questions
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 15, 2005, 01:07:48 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)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 15, 2005, 01:13:50 pm
ok will try and get back to you in  a bit
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 15, 2005, 01:44:05 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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 15, 2005, 02:11:54 pm
if you don't mind http://forum.coppermine-gallery.net/index.php?topic=5841.0
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 15, 2005, 02:22:39 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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 15, 2005, 02:33:06 pm
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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: 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?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 16, 2005, 01:19:50 am
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.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on October 16, 2005, 11:01:04 am
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
        (
            [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
(
    [ID] => 28170a5fb740e0164e6bbaa6877492ae
    [am] => 1
    [liv] => Array
        (
            [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
(
    [URI_array] => Array
        (
            [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 :


This mod is based on the 'Permanent Watermark with GD2 mod (http://forum.coppermine-gallery.net/index.php?topic=7160.0)'.
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
Code: [Select]
//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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: 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?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on October 16, 2005, 11:22:24 pm
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 :-(.


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?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: 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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on October 17, 2005, 09:29:54 am
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

as said.. tell me more.. tell me the things I asked for an dtell me the path you're using
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 17, 2005, 09:37:33 am
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
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 17, 2005, 11:56:15 am
ok figured out the problem, the mod works with gd but when i change ti imagemagik it doesnt work just stays loading.......any possible idea why it might be?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 17, 2005, 12:42:26 pm
the composite command seems not to work. You could try using mogrify ....
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: jbinc on October 17, 2005, 12:57:13 pm
mogrify actually isnt an option for the command line, tried another one, -average but still same thing....  :-\\
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 17, 2005, 01:13:52 pm
if you don't get results with 'whereis composite' or 'whereis mogrify' (in a shell) then ImageMagick isn't fully installed
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on October 17, 2005, 10:16:10 pm
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

According to your sugestions Stramm I back to the picmgmnt.inc.php from 1 site of this thread and watermarking was working properly!!! but only for the first time, next time not :-( but I didn't change anything.
I tried to make the same and next time but watermarking not working at all :-(, what is hell going on :-( ???
When I used picmgmnt.inc.php from 1 site, from the newest for multi users/watermarks or standard picmgmnt.inc.php from lib is still not working :-( brrrr....

Stramm you have any idea what is going on???



Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 18, 2005, 05:37:45 am
No, I can't really follow you. If you want, you can send me your ftp access info and a cpg admin login. Then I'll have a look
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 18, 2005, 08:09:50 am
oh boy, you have applied that watermark mod http://forum.coppermine-gallery.net/index.php?topic=7160.0

if you want it to work you'll have to use the original picmgmnt.inc.php that comes with coppermine and modify it accordingly.
If you want to use my watermark mod, then you'll have to install it. There's config stuff missing etc. and I bet some mysql stuff as well. I haven't checked all teh fiels but I guess you just have replaced the picmgmnt.inc.php and that's for sure not enough. These both mods aren't compatible. They work on a completely different way.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on October 18, 2005, 09:12:43 am
oh boy, you have applied that watermark mod http://forum.coppermine-gallery.net/index.php?topic=7160.0

if you want it to work you'll have to use the original picmgmnt.inc.php that comes with coppermine and modify it accordingly.
If you want to use my watermark mod, then you'll have to install it. There's config stuff missing etc. and I bet some mysql stuff as well. I haven't checked all teh fiels but I guess you just have replaced the picmgmnt.inc.php and that's for sure not enough. These both mods aren't compatible. They work on a completely different way.

Do you recommended me install whole gallery again (delete present gallery) ??? It's a longgg time to install whole gallery and upload whole pictures again :-(,

Or I can should change maybe only some kind of code in a few files???



Regards,
Pawel
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 18, 2005, 09:28:26 am
you don't need to reinstall CPG. And don't delete your pics and the database. If you haven't added other mods it's pretty easy. Just replace the files you've edited with unedited ones.. done.

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: pgrzegorc on October 18, 2005, 09:34:35 am
you don't need to reinstall CPG. And don't delete your pics and the database. If you haven't added other mods it's pretty easy. Just replace the files you've edited with unedited ones.. done.



But I wolud like to use your watermark hack because I would like to have one different watermark for each user, and what I should exactly do  to replace to your multi watermark mod???
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 18, 2005, 01:27:03 pm
then just remove the db entries you'd done when applying the other watermark mod
from the other thread:
Code: [Select]
insert into cpg11d_config (name, value) values ('enable_watermark', '1');
insert into cpg11d_config (name, value) values ('where_put_watermark', 'bottomright');
insert into cpg11d_config (name, value) values ('watermark_file', '/your/full/path/to/logo.png');
insert into cpg11d_config (name, value) values ('which_files_to_watermark', 'both');

and replace the modified files with fresh ones (if you haven't customized them). Otherwise just undo each of the steps mentioned there
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ISBB on October 21, 2005, 01:55:10 am
after installing the mod i get this on single up load

While executing query "SELECT auto_subscribe_post FROM **ERROR** WHERE user_id='2'" on 0

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '**ERROR** WHERE user_id='2'' at line 1
 File: C:\apache\htdocs\nick\ddr\gallery\include\functions.inc.php - Line: 105

Code: [Select]
USER:
------------------
Array
(
    [ID] => 1be5c48d8e2b11ebff77e5610f4bc080
    [am] => 1
    [liv] => Array
        (
            [0] => 19
        )

)

==========================
USER DATA:
------------------
Array
(
    [0] => 2
    [user_id] => 2
    [1] => ISBB
    [user_name] => ISBB
    [2] => 1
    [user_level] => 1
    [groups] => Array
        (
            [0] => 1
            [1] => 2
        )

    [group_quota] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [upload_form_config] => 3
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [custom_user_upload] => 0
    [disk_max] => 1024
    [disk_min] => 0
    [ufc_max] => 3
    [ufc_min] => 3
    [has_admin_access] => 1
    [group_name] => Admin
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content FROM cpg135_filetypes;
    [1] => SELECT user_id, username as user_name, user_level FROM `ddr`.phpbb_users WHERE user_id='2' AND user_password='77df7f6dfb16f51f7d9008c12765a986' AND user_active='1'
    [2] => SELECT (ug.group_id + 5) as group_id FROM `ddr`.phpbb_user_group as ug LEFT JOIN `ddr`.phpbb_groups as g ON ug.group_id = g.group_id WHERE user_id = 2 AND user_pending = 0 AND group_single_user = 0
    [3] => 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 cpg135_usergroups WHERE group_id in (1,2)
    [4] => SELECT group_name FROM  cpg135_usergroups WHERE group_id= 1
    [5] => DELETE FROM cpg135_banned WHERE expiry < '2005-10-20 16:47:08'
    [6] => SELECT * FROM cpg135_banned WHERE ip_addr='24.234.163.152' OR ip_addr='24.234.163.152' OR user_id=2
    [7] => SELECT aid, title FROM cpg135_albums WHERE category < 10000 ORDER BY title
    [8] => SELECT aid, title FROM cpg135_albums WHERE category='10002' ORDER BY title
    [9] => SELECT encoded_string FROM cpg135_temp_data WHERE unique_ID = '122baf2d'
    [10] => UPDATE cpg135_temp_data SET encoded_string = 'YTowOnt9' WHERE unique_ID = '122baf2d'
    [11] => SELECT category FROM cpg135_albums WHERE aid='1'
    [12] => INSERT INTO cpg135_pictures (pid, aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip) VALUES ('', '1', 'userpics/10002/', 'bdwg2~1.JPG', '41996', '64874', '584', '390', '1129852031', '2', 'ISBB','', '', '', 'YES', '', '', '', '', '24.234.163.152', '24.234.163.152')
    [13] => SELECT auto_subscribe_post FROM **ERROR** WHERE user_id='2'
)

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

==========================
POST :
------------------
Array
(
    [album] => 1
    [title] =>
    [caption] =>
    [keywords] =>
    [control] => phase_2
    [unique_ID] => 122baf2d
)

==========================
VERSION INFO :
------------------
PHP version: 4.3.4 - OK
------------------
mySQL version: 4.1.10a-nt
------------------
Coppermine version: 1.3.4
==========================
Module: gd
------------------
GD Support enabled
GD Version bundled (2.0.15 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read 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 3.23.49
==========================
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 | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .;c:\php\includes | .;c:\php\includes
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | aaron@z400.net | aaron@z400.net
sendmail_path | no value | no value
SMTP | mail.z400.net | mail.z400.net
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30000 | 30000
max_input_time | 3000 | 3000
upload_max_filesize | 2M | 2M
post_max_size | 8M | 8M
==========================
Page generated in 2.436 seconds - 14 queries in 0.026 seconds - Album set :

Any help.. :D
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ISBB on October 21, 2005, 01:57:26 am
and for what its worth.. this is bridged w/ phpbb  Also the image i was uploading.. ALSO uploaded correctly... :D  i just gotta figure out how to get rid of this error..
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 21, 2005, 10:05:02 am
it's not related to the watermark hack. This is a mod pack issue. And as you already figured out it's cause you have bridged your coppermine. To get rid of the error either add a column to your boards members table as I did with the CPGs member table and change the notification system queries.. or just turn off email notification on comments in config
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ISBB on October 21, 2005, 08:46:05 pm
Turned off e-mail notifications on comments in the config and the problem still persists... how do i go about the other route?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 22, 2005, 08:54:19 am
Ok, I checked where you got this errer and I guess it's while uploading. If you comment on a pic you may get on as well.

in picmgmnt.inc.php find
Code: [Select]
$result2 = db_query("SELECT auto_subscribe_post FROM {$CONFIG['TABLE_USERS']} WHERE user_id='".$user_id."'");
if(list($auto_subscribe_post) = mysql_fetch_row($result2)){
if ($CONFIG['enable_user_notification'] && $auto_subscribe_post) {
$result3 = db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE ctime='".$time."' AND filename='".addslashes($filename)."'");
    if(list($pid) = mysql_fetch_row($result3)){
db_query("INSERT INTO {$CONFIG['TABLE_NOTIFY']} (user_id, picture_id) VALUES('".$user_id."' ,'".$pid."')");
}
}
and delete it. Email notification won't work properly anymore. This is the part to auto subscribe to pics users upload
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ISBB on October 23, 2005, 09:25:39 pm
well if email notification is turned off in the config anyhow.. .what would it matter if thats deleted right?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 24, 2005, 04:24:46 pm
nothing.. was just to make it clear
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ISBB on October 24, 2005, 09:40:23 pm
let me give it a whirl.. :D  If not ill just delete it and start over again doing just the WM mod and that should cure the probs right..
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ISBB on October 25, 2005, 12:17:29 am
that didnt do it for me.. so i just restored my copy of the dbase and files pre the pack install... do you have JUST the watermark modded files or do i need to go do it by hand... and its on a pretty vanilla install w/ the exception of the briding as previously noted
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on October 25, 2005, 09:12:48 am
where do you get the error?
Just the watermark mod... that's described in this thread. No premodded files available.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ISBB on October 26, 2005, 02:58:04 am
I got that error after you upload... add title and choose album then it trys to place it in that album and thats when i get the error... but its aight now... i just went back to a pre pak setup and ill do the wm mod by hand.. the hard way.. yaaay.. :D
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: sion3000 on October 30, 2005, 03:02:50 am
Hello

I have just installed The watermark mod, admin mod, thumbs mod and the re-size mod. Everything was working fine up untill i added the re-size mod. When i am now uploading a photo it lets me select the image, then starts uploading. It then gives me the next screen asking for me to enter the info about the image. After that i then get a message Critical error - There was an error while processing a database query. No other error messages. I then click home (takes me to front page of gallery) and the image looks as though it has uploaded without any problems. It lets me click it and go into into it.

I have searched the boards and found a few issues with regards to corruption, ive repaird the picture table. But still i get he same message comming up. It does exactly the same for all users. I have been able to upload without any problems in the past. 1 posible solution for this problem im getting could be to do with the watermark mod not gone on correctly. If i set the watermark mod to off in the config screen it still runs. So to stop it from showing anything (even when its off) i have to set he image to transparent.

The web site is www.walesphotoindex.co.uk if you get a few mins.

If you can think of any ideas please PM me and let me know if you need any more info.

Kind regards

Sion


Coppermine: 1.33
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: sion3000 on October 30, 2005, 03:45:47 am
All fixed now, found the previous post with the email notifications. I think you missed the last } on the delete section. But it was a great help.

Anyway thanks :)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on November 02, 2005, 06:35:29 pm
All fixed now, found the previous post with the email notifications. I think you missed the last } on the delete section. But it was a great help.

Anyway thanks :)

yes, thanks for mentioning it. I've updated the picmgmnt.inc.php for that mod to fix a few problems but took a version that already had some more additions in it. This confusion and all the possible combinations are the reason for the mod pack. And that's always up to date ;)

edit: I guess somewhen this weekend I have time to play around a lil bit. Then I check what code needs to be removed in order to make most stuff work together with a bridged coppermine
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 07, 2005, 11:53:13 pm
i've been searching for my the prob i get with the watermark mod, i'm using the updated Mod Package you did a post about stramm. Anywys my error seems to be on like the line numbers?

[function.getimagesize]: failed to open stream: No such file or directory in /home/thebeerr/public_html/gallery/updatethumbs.php on line 61

its actually removing the thumnail files? www.thebeerrun.com/gallery   so i dont know what to do lol
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 08, 2005, 12:23:59 am
also this error on a different line number...

Warning: getimagesize(albums/userpics/10026/005_2A.JPG) [function.getimagesize]: failed to open stream: No such file or directory in /home/thebeerr/public_html/gallery/updatethumbs.php on line 61

so for some reason multiple pictures are missing when i run the admin tool and update the files to be watermarked.  I'm not sure what i did wrong, i added the SQL, used updated files.. etc? my folders are chmod properly?

and that updatethumbs.php is in the main folder.. not sure why it cant find it?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on November 08, 2005, 08:39:33 am
no, it doesn't remove thumbnail files. And the 'error' you mention is just a cosmetic issue. The 'better admin tools' don't check file types. I could add that if there's need for (maybe to avoid confusion). So I leave it up to the function getimagesize to decie if a file is an image or not. If it's a movie or a document... then no watremark gets applied, the 'image' doesn't get resized etc... and you get your 'error'. So it's expected behaviour.

So I don't know exactly if you have problems with your site cause you only tell me that error message. After looking at it there seems to be indeed a problem with your thumbs. Still it's not related to my mod pack. You can't see the thumbs cause the get displayed 1x1 but when opening the thumb URL directly the thumbs display... means they aren't deleted.

Have seen exactly that problem once before in the support board. However I can't remember the problem. Maybe you ask there again and another dev can remember
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 08, 2005, 07:56:24 pm
ok thanks i'll ask them
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 09, 2005, 04:35:14 pm
hey stramm, i just figured out my problem with my images getting removed, it had to do with the orignal files and the _normal resized files, when i deleted the back up copies, some of the files werent using the _normal image just the orignal copy i guess if it didn't need resized. I still can't resize my thumbnails now from 1x1 to normal size... not sure how, anyways...

So my next question is about the watermark mod, i still can't get it to work?

/home/thebeerr/public_html/gallery/include/logo.png 

is my path to my watermark, the logo is a png... I use GD2  , I set the watermark to on, transparancy to 80.. and apply.

members and myself, upload images using the single image upload which i allow 6 images at a time to be uploaded. None get watermarked?

I've been manaully adding watermarks to images i upload, but i'd like my mmember images to get watermarked automaticlly.   

Any reasons why this might not be working? my path is full line path, GD2? trancparancy is set.. I'm not sure what else is wrong? chmod for the logo is 777?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on November 09, 2005, 05:52:47 pm
looks like you haven't just deleted the backup but the original as well.... I've viewed a view pics and this is for all so far.
Just tried what may have been gone wrong. And yes... if you delete the backups, then the origs and the MySQL part fails.. then the result is what you have on your site now. Backups and origs gone... but the origs still linked and used as image size reference.

edit: tested even more... check if you have normal images everywhere and only the orig is missing. If you can answer that with yes then make backups of everything (pics +db) and run the admin tools again.
Select the album in question and check 'Delete original size photos'.... this will spit out a lot of errors but if all works well it will rename the normals and use them as original images. This will be then the image size reference too.

For the watermark. Usually it's a wrong absolute path. Set the transparency to 50% to start with. If you use both png background transparency and the transparency setting in config, then there may be problems with GD2. A fix is somewhere in this thread. If you can't get the watermark going then tell me and I'll have a look
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 09, 2005, 07:15:12 pm
yeah thats exactly what i have is normal_ images everywhere and some no longer around. but the majortiy are all normal_ images now lol.. okay yeah i'll give that a shot, what do you mean by making a back of the database? db? 

as for the thumbnails, i just made the config "exact" size for the thumbnails and it everything to 120 x 80 or so, some look off but it is better then 1x1.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 09, 2005, 07:40:10 pm
Warning: imagecreatefrompng(/public_html/gallery/include.png) [function.imagecreatefrompng]: failed to open stream: No such file or directory in /home/thebeerr/public_html/gallery/include/picmgmt.inc.php on line 363

Warning: imagesx(): supplied argument is not a valid Image resource in /home/thebeerr/public_html/gallery/include/picmgmt.inc.php on line 364

Warning: imagesy(): supplied argument is not a valid Image resource in /home/thebeerr/public_html/gallery/include/picmgmt.inc.php on line 365

Warning: imagecolorat(): supplied argument is not a valid Image resource in /home/thebeerr/public_html/gallery/include/picmgmt.inc.php on line 386

Warning: imagecolortransparent(): supplied argument is not a valid Image resource in /home/thebeerr/public_html/gallery/include/picmgmt.inc.php on line 386

Warning: imagecopymerge(): supplied argument is not a valid Image resource in /home/thebeerr/public_html/gallery/include/picmgmt.inc.php on line 387



I get that error now that i changed the path of my logo file, /www/gallery/include/logo.png     

so atleast it is detecting it now?  hmm
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on November 09, 2005, 08:12:13 pm
nope, it doesn't see the watermark pic. Your old path seemed to be correct
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 09, 2005, 08:34:19 pm
okay.. i set it back to the previous path to the logo, and no errors, just no watermark... I set trancparancy to 50%, and applied, i go back to check on it, and it no longer says 50%? is that normal?  I also tried just 50, without the % sign.. thinking that was the problem, same thing.  Is it normal for it not display the setting i set in the trancparancy when you check config again?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on November 09, 2005, 08:42:24 pm
no, not normal.. you just enter '50'
if it doesn't save then the mysql isn't properly applied
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 09, 2005, 08:48:10 pm
okay, i'll play with my sql some more, im pretty sure i added it all, but i'll re do it just in case.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 09, 2005, 09:33:34 pm
thats what it was! I guess some of the watermark sql info was added, but not the bottom half for some reason. Anyways i fixed the watermark problem! yes! haha thank you!

Now i noticed another problem when the watermark is added, i use a png 24 file with no background set to trancparent background.. and when the watermark mod ads it, it puts a white background on it unless i set the transparancey down? and when i set the tranceparancy down it looks weird? any reasons why that could be?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on November 09, 2005, 11:40:04 pm
i guess the png logo only looks weird if i add drop shadow to it, or some type of effect..
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on November 10, 2005, 09:22:32 am
For the watermark. Usually it's a wrong absolute path. Set the transparency to 50% to start with. If you use both png background transparency and the transparency setting in config, then there may be problems with GD2. A fix is somewhere in this thread. If you can't get the watermark going then tell me and I'll have a look
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Cainte on November 13, 2005, 05:26:04 pm
It may be me english is too bad... but WHERE is the Undo Possibility?? How can I undo the watermarks.

I'd be verry happy if someone could explain it to me.

sorry...
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mylogon on November 14, 2005, 04:45:44 am
I asked quite a while ago the same question.  Here is the link to the answer:

http://forum.coppermine-gallery.net/index.php?topic=16286.msg97318#msg97318
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: benkolap on November 23, 2005, 07:42:13 am
i have just installed the watermark code but nothing happen, and nothing show in config. help?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Joachim Müller on November 23, 2005, 08:30:37 am
how could anyone possibly help you, without a link to your page or any idea what exactly you did wrong? Without further details, nobody will be able to help you at all. ::)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Zeitgeist on November 23, 2005, 09:15:35 pm
Is this on the fly, or does it permantely mark the image file with a watermark? I'm using the old ImageMagick one and it does it on the fly so the original files aren't modified.

Have you at least read the thread's subject? If that attracts your attention maybe post 1 in this thread tells you more about it's contents

I did it read, and reread it, but I was still confused. I was under the impression it DID mark the file, but I wasn't sure as English isn't my first language. Thanks.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on November 24, 2005, 06:05:03 pm
then you're not using this watermark mod. This one here is not watermarking on the fly but adding a permanent watermark. Before doing this it makes a backup of your image. So if you decide later not to have watermarked images anymore you can undo your changes
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: benkolap on November 25, 2005, 02:53:55 am
here is the link  ;D
http://khmer.info/modules.php?name=coppermine

also the Last uploads :: Last comments :: Most viewed :: Top rated :: on the menu are not working. any idea?

how could anyone possibly help you, without a link to your page or any idea what exactly you did wrong? Without further details, nobody will be able to help you at all. ::)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Joachim Müller on November 25, 2005, 09:23:11 am
you're using the outdated and unsupported nuke port of coppermine. We don't know how it works, but I'm convinced that you can't use this mod with it, as it has been made for the standalone version of coppermine.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mustang_lex on December 12, 2005, 03:39:44 am
OK for one thing Kudos to you Stramm. You did a great job. I have read all 13 pages so far to see if I can find the answer to my one and only problem, and even though others are getting the same thing. I hope this explanation will help.

The problem is quality of some photo are very pixelated.

After studying my coppermine gallery at http://www.stangette.com/showcase (http://www.stangette.com/showcase)
I saw one thing in common. All my photos that are posted as "landscape" (width is more then the height) come out PERFECT! Both the resized and original show up with out any flaws and the watermark shows perfect.  NOW whats happening is All my photos that are posted "portrait" (height is more then width) are having the pixelation issue. BUT ONLY THE ORIGINAL. The resized ones which are display with in the gallery are fine, BUT the popup for the original comes out pixelated. But not only does the photo comeout pixelated but also the watermark.

So I saved the image on my computer, and what do you know. Theres NO pixelation. soooo I feel it has to do with "displayimage.php" for some reason "displayimage.php" blows up the image bigger.

To see what I mean go to this link. Look at "landscape" shots and see the good quality with full size then view "portrait" shots (theres 2 in this album) and click full view and see the pixelation.

http://www.stangette.com/showcase/thumbnails.php?album=42 (http://www.stangette.com/showcase/thumbnails.php?album=42)

I don't know much about this hack but I have a good feeling its something with "displayimage.php"

Thank You
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on December 12, 2005, 01:23:31 pm
right... I think I've fixed that issue in the modpack but forgotten to offer a solution for the watermark only thingie. Give me a lil bit... maybe I can remember what I did to solve this lil problem ;)

uhmm... If you don't do that already.... please use an up to date picmgmnt.inc.php (try the one from the modpack, it should work, but don't overwrite your actual copy. Instead rename it)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mustang_lex on December 12, 2005, 05:30:46 pm
Cool thanks Stramm. 8) I will download the pack. I did just follow the instructions for the watermark hack. Will I have to Redue the Full Size photos for all albums in the Admin Options again?

UPDATE: I download the modpack and uploaded "picmgmnt.inc.php" and Updated "Both normal and full sized (if a orig copy is available)" in Admin Tools and I still get the pixelation . Must be another fix, I will wait for ya:)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mustang_lex on December 14, 2005, 09:00:58 pm
Hey Stramm. Just wondering if you had any luck :) I tried copying the file fromt he mod pack and got an error when you finally confirm a new photo upload so I reverted back to the original modified picmgmnt.inc.php file from your tutorial.

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on December 15, 2005, 11:23:46 am
I can't ferify that behaviour with mny installation... so it's hard for me to offer a fix. Give me more info (GD, ImageMagick), do you use other mods (espacially the resize fullsized images mod... ) etc.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mustang_lex on December 15, 2005, 10:40:30 pm
If theres anything I can offer. let me know. I use Imagemagick not GD. Like I said. Whatever you need. No mods except your watermark one. I took out the 5 star rating, but all i did was remove 1 to 4 gifs and changed the 5 gif to say vote instead. Thats the only mods.

It is integrated with Vbulletin 3.0.7 too :)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on December 16, 2005, 08:44:10 am
Please PM me for my email addy, zip your coppermine dir except images and config.inc.php and email me the zip
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Scenemusic on December 30, 2005, 06:21:02 pm
I added the hack, it works fine BUT ;)

the image After watermarking : http://www.linkedscene.com/photo/albums/userpics/10001/nu468301.jpg

We can see only a grey background with 60 % transparency

The watermark png : http://www.linkedscene.com/photo/images/christophe.png (Potoshop PNG 24 with bg transparency)

gosh ... what can i do ? :)

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: TheGamer1701 on January 05, 2006, 10:37:04 am
Hello Stramm,

this seems like a great mod to me,
but unfortunetly this thread has become too crowded, you can't find all the mods easy enough.

Could you at least try and keep the most importants mods/changes/source codes at page 1?
I checked for the individual watermarking and the source codes differ, it seems to me that the code on page 1 doesn't support this feature.


Also,
I have problems with the language file.
Did you check for compatibility with the latest coppermine version? (cpg 1.4.3 - released 27 December 2005)
Seems like they changed the language files...



UPDATE:
Ok, I just checked it and tried modifying the other files, but that doesn work, too.
Some stuff in util.php has changed, too.
Could you try to make an update for cpg1.4.3 ?
I really want the user individual watermarks, and the CPGMark Plugin doesn't work ^^
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Joachim Müller on January 05, 2006, 12:16:47 pm
but unfortunetly this thread has become too crowded, you can't find all the mods easy enough.
Then don't clutter it even more yourself.

Could you try to make an update for cpg1.4.3 ?
I already told you on the other thread: http://forum.coppermine-gallery.net/index.php?topic=24540.0

I really want the user individual watermarks, and the CPGMark Plugin doesn't work ^^
Then post on the thread that deals with the CPGMark Plugin instead of cluttering this thread. It does work, but you seem to make mistakes.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on January 06, 2006, 09:55:05 pm
I added the hack, it works fine BUT ;)

the image After watermarking : http://www.linkedscene.com/photo/albums/userpics/10001/nu468301.jpg

We can see only a grey background with 60 % transparency

The watermark png : http://www.linkedscene.com/photo/images/christophe.png (Potoshop PNG 24 with bg transparency)

gosh ... what can i do ? :)




I guess you're using GD2. Problems may occur if you use transparent background and image transparency. If that's the case search this thread, I've already posted a solution somewhere
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: MavricK on February 21, 2006, 03:55:33 am
there are a lot of possibilities to fix that
1. use IMagick
1. only use one of the transparency features at a time (only transparent background or transparency against the image background)... not nice, I know
3. Make the background not transparent in the wm image but eg. white. Then use Set color transparent x,y and point it to a white point in your watermark (usually x,y = 1 should do). If you've set this, then GD2 will make all white pixels transparent. Still there's a backdraw, it doesn't look to pretty
4. The best solution is to make the image background transparant as you did. Then set layer transparency of the watermark to ~30-40. Save as png24 with transparency. Now the image transparency in config doesn't have a function anymore. You control it just with the layer transparency in your paint proggy.
now find in picmgmnt.inc.php
Code: [Select]
ImageCopyMerge($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH,$CONFIG['watermark_transparency']); //$dst_x,$dst_y,0,0,$logoW,$logoH);and replace with
Code: [Select]
ImageCopy($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH);
If I'm not mistaken then this problem only occurs with newer php versions

wow i just want to say, option #4 works perfect and has made my watermark much much better. Thank you so much Stramm . 
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Impeerator on April 15, 2006, 06:49:39 pm
Hi!

First I have to say: Well done! It's a great mod! I installed it now and it works properly, but I still have two small problems.

1. I still don't understand the whole thing with the transparency. I've made a logo with white text on a black background and wanted the watermark to be the whole image (with the black background) tranparent. But it's only the white text which becomes the watermark. I've tried everything with the png-file: with transparency, without transparency, with black background, with white background. But it's always the same. How can I get the black background of the image to be in the watermark, too? With transparency?

Edit: I solved this problem now :) Now it sets the watermark on every picture I upload. But when I want to update already existing images, I only get an Error:
Fatal error: Call to undefined function: watermark() in /homepages/18/d107423735/htdocs/coppermine/util.php on line 302
How to fix this?

2. When I now upload images onto the site, everything functions very well. But now this blue "OK"-Button which says that the upload went well, doesn't appear anymore. There's only a red "X" instead. And the path of the image of the blue "OK"-button is very strange:
http://www.impeerator.de/coppermine/addpic.php?aid=56&pic_file=MDFfdGVzdC9iaWxkXzAwMS5KUEc
So I think somewhere in a php-file there is a mistake, but I can't find it...

Can somebody help me with these problems? The last problem is not that urgent, but I want to see this blue "OK" ;)

By the way, this is the site where I put in the mod: http://www.fh-pics.de (http://www.fh-pics.de) But I have not put the watermark on the pictures yet.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: 2hoch5 on April 17, 2006, 11:01:27 am
Hello,

i searched and searched and .......
but i can't find any watermark hack which can handle with groups.
i want that only selected groups see the watermarks.
it would be nice if someone can help me.

thanks
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 17, 2006, 07:42:02 pm
Hi!

First I have to say: Well done! It's a great mod! I installed it now and it works properly, but I still have two small problems.

1. I still don't understand the whole thing with the transparency. I've made a logo with white text on a black background and wanted the watermark to be the whole image (with the black background) tranparent. But it's only the white text which becomes the watermark. I've tried everything with the png-file: with transparency, without transparency, with black background, with white background. But it's always the same. How can I get the black background of the image to be in the watermark, too? With transparency?

Edit: I solved this problem now :) Now it sets the watermark on every picture I upload. But when I want to update already existing images, I only get an Error:
Fatal error: Call to undefined function: watermark() in /homepages/18/d107423735/htdocs/coppermine/util.php on line 302
How to fix this?

2. When I now upload images onto the site, everything functions very well. But now this blue "OK"-Button which says that the upload went well, doesn't appear anymore. There's only a red "X" instead. And the path of the image of the blue "OK"-button is very strange:
http://www.impeerator.de/coppermine/addpic.php?aid=56&pic_file=MDFfdGVzdC9iaWxkXzAwMS5KUEc
So I think somewhere in a php-file there is a mistake, but I can't find it...

Can somebody help me with these problems? The last problem is not that urgent, but I want to see this blue "OK" ;)

By the way, this is the site where I put in the mod: http://www.fh-pics.de (http://www.fh-pics.de) But I have not put the watermark on the pictures yet.

I don't use a function watermark... so maybe you mixed up 2 different threads???
update your coppermine at least to 1.3.5 better 1.4.4
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 17, 2006, 07:43:35 pm
Hello,

i searched and searched and .......
but i can't find any watermark hack which can handle with groups.
i want that only selected groups see the watermarks.
it would be nice if someone can help me.

thanks

this is for CPG 1.3x and it's applying a permanent watermark. Means it's on the image, no matter for what group
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: 2hoch5 on April 17, 2006, 10:28:18 pm
this is for CPG 1.3x and it's applying a permanent watermark. Means it's on the image, no matter for what group

yes, i know. but is there a script whick can do that?
or is it possible that the "special" users can see the "backupped"
images which don't have a watermark?
i hope it is possible to understand me :D
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 17, 2006, 11:07:02 pm
I don't know of any mod that'll do what you're looking for

and due to several reasons the 'show orig file for some groups' is messy (just think of these headwords: intermediate <-> fullsized, automatically resize fullsized image, on the fly resize etc.)

If however you still want to go for that... start with displayimage.php (below // Retrieve data for the current picture, do the necessary if clause and preg_replace or similar)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Impeerator on April 18, 2006, 12:43:57 am
I don't use a function watermark... so maybe you mixed up 2 different threads???
update your coppermine at least to 1.3.5 better 1.4.4

Oh yes, that's possible. I first did the modifications from this thread (http://forum.coppermine-gallery.net/index.php?topic=7160.0), but I wanted the watermark to be transparent, and so I added your modifications from this thread. So I think I didn't remove everything from the first mod?

Can I update coppermine to the newest version without deleting my modifications?

Thanx for your answers :)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: 2hoch5 on April 18, 2006, 01:21:38 am
If however you still want to go for that... start with displayimage.php (below // Retrieve data for the current picture, do the necessary if clause and preg_replace or similar)

yes i still want to go for that :D....but i can't prog such thing :D
if anyone has an idea, please let me know.

THX
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 18, 2006, 08:25:49 am
Oh yes, that's possible. I first did the modifications from this thread (http://forum.coppermine-gallery.net/index.php?topic=7160.0), but I wanted the watermark to be transparent, and so I added your modifications from this thread. So I think I didn't remove everything from the first mod?
As said, I think the same

Quote
Can I update coppermine to the newest version without deleting my modifications?
no, you'll have to apply the watermark mod for 1.4
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: ymca on April 29, 2006, 05:07:12 pm
Hi guys,

are there files that i can download to put in cpg 1.4.5 that will add permanent watermark?

or is there a plugin?

hope you can help,
thnx
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on April 29, 2006, 05:27:41 pm
this thread is marked CPG1.3x, look for CPG1.4x watermark threads
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mukoh on May 02, 2006, 08:48:09 am
[Edit GauGau]
Warning, the below link is not worksafe. I wasn't able to spot coppermine-driven pages easily - just dropping a link to your site is bad, especially when linking to an adult site. Don't make supporters search your page. Post a deep link to coppermine-driven pages.
[/edit]

Stramm the plugin that I installed from you works good for watermarking. But all of a sudden coppermine started asking for some plugin to view full pic. What gives? It is at http://www.teenagegirlnude.com can you check  please?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on May 02, 2006, 09:35:29 am
As GauGau I can't find a coppermine installation.
If a script works for quite some time then it's unlikely that it suddenly stops. Usually the culprit is external (changed system settings, full hd etc)

In your case I'd check my own computer. If you're running adult sites you should know how they work and that there are some not so nice guys amongst porn webmasters. Even your trades could throw forced malware installs on you. If not today than tomorrow. Now lnks are redirecting that always worked etc.

But as already mentioned without a link to your coppemine install no one would be able to help you.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mukoh on May 02, 2006, 06:51:00 pm
Stramm I apologise for the PM. Do you want me to give you the admin login and pass to the site? There are no trades on the site. But I don't even know where the plugin to show picture came from. Its a straight up mystery.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on May 02, 2006, 06:56:02 pm
a link to the gallery would be a good start
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mukoh on May 02, 2006, 07:12:43 pm
Here it is Stramm.
http://teenagegirlnude.com/gallery/  THE LINK IS NOT SAFE FOR WORK> :)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on May 02, 2006, 07:42:41 pm
somehow the script doesn't recognize your images as images anymore => when creating the displayimage page CPG checks for the content to be image, document, if neither of these both CPG assumes the content to be movie and embeds a movie player... that's your problem

Try setting
config -> Files and thumbnails advanced settings -> Allowed image types to ALL

Also properly setup your gallery ('URL of your coppermine gallery folder' is somehow important too)
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: mukoh on May 02, 2006, 08:16:43 pm
Stramm the thing is. It is all setup and images ALL as well. It was showing images just fine. Then stopped and started trying to play them as plugin.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: docgonzo on June 14, 2006, 01:44:06 pm
Stramm the thing is. It is all setup and images ALL as well. It was showing images just fine. Then stopped and started trying to play them as plugin.
I just recovered from the same error...
Reupped original coppermine, ran update.php, everything worked normal (vanilla CPG)
After that, reupped the modpack, ran update.php again, and everything works like it should.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: debragrant on July 16, 2006, 08:07:13 pm
problem:

I don't have / can't find $lang_config_php in english.php
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Nibbler on July 16, 2006, 08:12:34 pm
Then you are not using 1.3.x and so this mod is not suitable for you.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: debragrant on July 16, 2006, 08:22:31 pm
also in cpg_config do i make a new php code/file? and do I write the code word or word adding the path to logo?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: debragrant on July 16, 2006, 08:24:29 pm
Then you are not using 1.3.x and so this mod is not suitable for you.

oh that might be the problem lol just check mines 1.4.5 is there a mod for that?
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Joachim Müller on July 16, 2006, 08:52:18 pm
Means that you're using cpg1.4.x, where the string name has been changed to $lang_admin_php. This thread here is for cpg1.3.x and should only be used if you actually run that version. Use a watermarking mod that was designed for your coppermine version, don't clutter this thread by asking cross-version questions.
Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: rajraj on May 14, 2007, 03:21:46 am
hi, where is this code found - which i am supposed to edit to get watermark?

i got this gallery function on my website by installing it from my control panel from my hosting website - so its offered as standard you can say.

therefore i have no access - or i think i have no access to the code of my gallery.

please help me find this place where i am suppose to edit this code to make all my images secure with watermark as its vital for me.

also is this the latest and best solution we have so far - as it seems there have been soo many ways to prevent permission, saving of file etc.

i have deduced disabling right click is not the best way -therefore i wish to watermark eveything.

thanks

Title: Re: Permanant watermark with undo possibility (GD2+IMagick)
Post by: Stramm on May 14, 2007, 08:00:16 am
Don't ask the same question twice.
http://forum.coppermine-gallery.net/index.php?topic=29817.msg208017#msg208017