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

News:

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

Main Menu

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

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

Previous topic - Next topic

0 Members and 6 Guests are viewing this topic.

Stramm

What this mod does
a) it will watermark fullsized and intermediate images (you can set the one or other or both in config)
b) you can turn watermarking on/ off
c) creates a backup of the images (so you can undo watermarking)
d) works with ImageMagick and GD2
e) permanent watermark - puts no extra heat on the server (only when uploading images)
f) several tarnsparency options
g) better admin tools
h) no hardcoded language (supports language files) - added english... so you'll have to switch to english in order to do the config settings (or translate to your lang)

You'll find new entries in coppermine config (Image watermarking)
If you do not enable watermarking here nothing will change compared to an unmodded coppermine (as it should). But as soon as you turn watermarking on, a backup will be created from all new uploaded images and a watermark applied to the intermediate image, the fullsized one or both (depending on your config settings). If you want old images to get the watermark too, then you have to run the admin tools. To make it more comfortable for you I've added an 'auto refresh' feature.
When you're recreating thumbs/ images in the admin tools then you can set an auto refresh flag. If set, the update process auto refreshes and you won't need to click 'continue' anymore.
The big advantage.... you can set the number of images to process to a  low value eg (2-5). Now the chances the script times out are limited. Means you don't need to restart the entire process and sit in front of your monitor for hours clicking 'continue' (if you've a huge number of pics in your db)
You can turn auto refresh on/ and off on the admin tools page
Update thumbs and/or resized photos (1) - (checkbox) Auto refresh (no need to click continue button anymore)

To undo watermarks just disable watermarking in config and run the admin tools.
Oh, no you can chose in the admin tools to update only thumbs, only intermediate, only fullsized, thumb and intermediate, intermediate and fullsized or all three

Of course you can delete the backup too (admin tools - Delete original image backup)
However I do not recommend this. Afterwards you won't be able to undo your watermarks. Better undo watermarks and then remove the backup files (unless you're absolutely sure you never will want to remove the watermarks)

Setup:
just apply the following code, replace include/picmgmnt.inc.php with the attached file and run update.php

now have a look at your coppermine config. You'll need to modify the path to the watermark. Preset is a file watermark.png in the coppermine images folder. If that doesn't work for you, use the absolute path to the watermark image

The watermark image should be a .png file. You can make its background transparent in your paint program. Another option to achive that effect is to use feather x,y (GD2 only). Set some point x,y of your watermark image and GD2 will render it transparent. This will not nearly look as good as doing that in your paint program.  The transparency settings in config will make the entire watermark transparent to the image background (ImageMagick only).
If you use GD2 then the transparency setting in config has no function. If you want the watermark to be transparent against the background, then reduce layer transparency of your watermark image in your paint proggy to eg. 50

I was working on the watermark mod and have enhanced it's functionality. Now it's able to add a huge watermark file to huge  images and downsize the watermark on small images.
go here to apply the extra http://forum.coppermine-gallery.net/index.php?topic=29817.msg143122#msg143122



Stramm

Always make a backup of your files and the db before applying a mod

For the Germans: I've written an upgrade guide that explains backing up database and files on *nix systems.
http://forum.coppermine-gallery.net/index.php?topic=30411.msg140843#msg140843


-sql/update.sql
scroll down to the end of that file and add

#watermark
INSERT INTO CPG_config (name, value) values ('enable_watermark', '0');
INSERT INTO CPG_config (name, value) values ('where_put_watermark', 'southeast');
INSERT INTO CPG_config (name, value) values ('watermark_file', 'images/watermark.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', '50');
INSERT INTO CPG_config (name, value) values ('watermark_transparency_featherx', '0');
INSERT INTO CPG_config (name, value) values ('watermark_transparency_feathery', '0');



-lang/english.php
find

if (defined('ADMIN_PHP')) $lang_admin_php = array(

below add

  'wm_bottomright' => 'Bottom right', //cpg1.4 mod watermark
  'wm_bottomleft' => 'Bottom left', //cpg1.4 mod watermark
  'wm_topleft' => 'Up left', //cpg1.4 mod watermark
  'wm_topright' => 'Up Right', //cpg1.4 mod watermark
  'wm_center' => 'Center', //cpg1.4 mod watermark
  'wm_both' => 'Both', //cpg1.4 mod watermark
  'wm_original' => 'Original', //cpg1.4 mod watermark
  'wm_resized' => 'Resized', //cpg1.4 mod watermark


find

  array('Default mode for files', 'default_file_mode', 0, 'f=index.htm&as=admin_picture_thumb_advanced_chmod_files&ae=admin_picture_thumb_advanced_chmod_files_end'), //cpg1.4

below add


  'Image watermarking',
  array('Watermark Image', 'enable_watermark', 1),
  array('Where to place the watermark', 'where_put_watermark', 18),
  array('Which files to watermark', 'which_files_to_watermark', 19),
  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),


find

  'delete_orphans_explanation' => 'This will identify and allow you to delete any comments associated with files no longer in the gallery.<br />Checks all albums.', //cpg1.4

below add

  'update_full_normal_thumb' => 'Everything... full sized, resized and thumbs',
  'update_full_normal' => 'Both resized and full sized (if a orig copy is available)',
  'update_full' => 'Just full sized (if a orig copy is available)',
  'delete_back' => 'Delete original image backup (watermark mod)',
  'delete_back_explanation' => 'This will delete the backup image. You will save some disk space but not be able anymore to undo the watermark!!! After that the watermark will be permanent',
  'finished' => '<br />Finished updating thumbs/ images!<br />', //modpack cpg1.4
  'autorefresh' => ' Auto refresh (no need to click continue button anymore)<br /><br />', //modpack cpg1.4


find

  'fs_pic' => 'full size image',

below add

  'orig_pic' => 'original image',



-admin.php
find 

function create_form(&$data)

above add

function form_watermark($text, $name)
{
   global $CONFIG, $lang_admin_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_admin_php['wm_bottomright']}</option>
                               <option value="southwest" $southwest_selected>{$lang_admin_php['wm_bottomleft']}</option>
                               <option value="northwest" $northwest_selected>{$lang_admin_php['wm_topleft']}</option>
                               <option value="northeast" $northeast_selected>{$lang_admin_php['wm_topright']}</option>
                               <option value="center" $center_selected>{$lang_admin_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_admin_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_admin_php['wm_both']}</option>
                               <option value="original" $original_selected>{$lang_admin_php['wm_original']}</option>
                               <option value="resized" $resized_selected>{$lang_admin_php['wm_resized']}</option>
                       </select>
               </td>
       </tr>

EOT;
}




find

                case 17 :
                    form_asc_desc($element[0], $element[1], $element[3]);
                    break;

below add

              //Watermark place
              case 18 :
                  form_watermark($element[0], $element[1]);
                    break;
              //Which filest to watermark
              case 19 :
                  form_watermark2($element[0], $element[1]);
                    break;



-util.php
find

$defpicnum = 45;

and replace with

$defpicnum = 5;


find

                <input type="radio" name="updatetype" id="updatetype3" value="2" checked="checked" class="nobg" /><label for="updatetype3" class="clickable_option">'.$lang_util_php['update_both'].'</label><br />'.$lang_util_php['update_number'].'
                <input type="text" name="numpics" value="'.$defpicnum.'" size="5" class="textinput" /><br />'.$lang_util_php['update_option'].'<br /><br />'),

and replace with

                <input type="radio" name="updatetype" id="updatetype3" value="2" class="nobg" /><label for="updatetype3" class="clickable_option">'.$lang_util_php['update_both'].'</label><br />
                <input type="radio" name="updatetype" id="updatetype5" value="4" class="nobg" /><label for="updatetype5" class="clickable_option">'.$lang_util_php['update_full'].'</label><br />
                <input type="radio" name="updatetype" id="updatetype4" value="3" checked="checked" class="nobg" /><label for="updatetype4" class="clickable_option">'.$lang_util_php['update_full_normal'].'</label><br />
                <input type="radio" name="updatetype" id="updatetype6" value="5" class="nobg" /><label for="updatetype6" class="clickable_option">'.$lang_util_php['update_full_normal_thumb'].'</label><br />
'.$lang_util_php['update_number'].'
                <input type="text" name="numpics" value="'.$defpicnum.'" size="5" class="textinput" /><br />'.$lang_util_php['update_option'].'<br /><br />
                <input type="Checkbox" name="autorefresh" checked value="1" class="nobg" />'.$lang_util_php['autorefresh']
),


replace the entire function update_thumbs() with


function update_thumbs()
{
        global $CONFIG, $lang_util_php;

        $albumid = (isset($_REQUEST['albumid'])) ? $_REQUEST['albumid'] : 0;
        $albstr = ($albumid) ? "WHERE aid = $albumid" : '';
        $autorefresh = $_REQUEST['autorefresh'];
        $updatetype = $_REQUEST['updatetype'];
        $numpics = $_REQUEST['numpics'];
        $startpic = (isset($_REQUEST['startpic'])) ? $_REQUEST['startpic'] : 0;

        echo "<h2>{$lang_util_php['thumbs_wait']}</h2>";

        $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} $albstr LIMIT $startpic, $numpics");
        $count = mysql_num_rows($result);

        while ($row = mysql_fetch_assoc($result)){

                $image = $CONFIG['fullpath'] . $row['filepath'] . $row['filename'];
                $normal = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['normal_pfx'] . $row['filename'];
                $thumb = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['thumb_pfx'] . $row['filename'];
                $mini = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['mini_pfx'] . $row['filename'];
$orig=$CONFIG['fullpath'] . $row['filepath'] . $CONFIG['orig_pfx'] . $row['filename'];

if (file_exists($orig)) {
$work_image=$orig;
$orig_true='true';
} else {
$work_image=$image;
$orig_true='false';
}

        $imagesize = getimagesize($work_image);
        if ($updatetype == 0 || $updatetype == 2 || $updatetype == 5)  {
            if (resize_image($work_image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false", 1)) {
                echo $thumb .' '. $lang_util_php['updated_succesfully'] . '!<br />';
                my_flush();
            } else {
                echo $lang_util_php['error_create'] . ':$thumb<br />';
                my_flush();
            }
        if ($CONFIG['enable_mini_thumbs'] == '1') {
            if (resize_image($work_image, $mini, $CONFIG['mini_thumb_width'], $CONFIG['thumb_method'], "mini", "false", 1)) {
                echo $mini .' '. $lang_util_php['updated_succesfully'] . '!<br />';
                my_flush();
            } else {
                echo $lang_util_php['error_create'] . ':$mini<br />';
                my_flush();
            }
}
}

        if ($updatetype == 1 || $updatetype == 2 || $updatetype == 3 || $updatetype == 5)
{
            ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized') ? $watermark="true" : $watermark="false";
            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))
{
                    echo $normal . " " . $lang_util_php['updated_succesfully'] . '!<br />';
                    my_flush();
}
                else
{
                    echo $lang_util_php['error_create'] . ':$normal<br />';
                    my_flush();
                }
            }
}
        if ($updatetype == 3 || $updatetype == 4 || $updatetype == 5) 
{
($CONFIG['thumb_use'] == "ex") ? $resize_method = "any" : $resize_method = $CONFIG['thumb_use'];

        if (((USER_IS_ADMIN && $CONFIG['auto_resize'] == 1) || (!USER_IS_ADMIN && $CONFIG['auto_resize'] > 0)) && max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']){ //$CONFIG['auto_resize']==1
$max_size_size = $CONFIG['max_upl_width_height'];
}
else {
$resize_method = "orig";
$max_size_size = max($imagesize[0], $imagesize[1]);
}
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($work_image, $image, $max_size_size, $CONFIG['thumb_method'], $resize_method, 'true'))
{
             echo $image . " " . $lang_util_php['updated_succesfully'] . '!<br />';
             my_flush();
}
                else
{
                    echo $lang_util_php['error_create'] . ':$image<br />';
                    my_flush();
                }
}
}
} else {
        if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')
{
if (resize_image($work_image, $image, $max_size_size, $CONFIG['thumb_method'], $resize_method, 'true'))
{
             echo $image . " " . $lang_util_php['updated_succesfully'] . '!<br />';
             my_flush();
}
                else
{
                    echo $lang_util_php['error_create'] . ':$image<br />';
                    my_flush();
                }
} else {
        if (((USER_IS_ADMIN && $CONFIG['auto_resize'] == 1) || (!USER_IS_ADMIN && $CONFIG['auto_resize'] > 0)) && max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']){
if (resize_image($work_image, $image, $max_size_size, $CONFIG['thumb_method'], $resize_method, 'false'))
{
             echo $image . " " . $lang_util_php['updated_succesfully'] . '!<br />';
             my_flush();
}
                else
{
                    echo $lang_util_php['error_create'] . ':$image<br />';
                    my_flush();
                }
} elseif (copy($orig, $image))
{
                    echo $orig . " " . $lang_util_php['updated_succesfully'] . '!<br />';
                    my_flush();
}
                else
{
                    echo $lang_util_php['error_create'] . ':$image<br />';
                    my_flush();
                }
}
}
}
        $imagesize = getimagesize($image);
$query_up = "UPDATE {$CONFIG['TABLE_PICTURES']} SET pwidth='$imagesize[0]' , pheight='$imagesize[1]' WHERE pid='".$row['pid']."' ";
cpg_db_query($query_up);
}

        if ($count == $numpics){

                $startpic += $numpics;
if($autorefresh) {
echo <<< EOT
<meta http-equiv="refresh" content="1; URL=util.php?numpics={$numpics}&startpic={$startpic}&albumid={$albumid}&autorefresh={$autorefresh}&action=update_thumbs&updatetype={$updatetype}">
EOT;
}
else
{
        echo <<< EOT
                <form action="util.php" method="post">
                                <input type="hidden" name="action" value="update_thumbs" />
                                <input type="hidden" name="numpics" value="$numpics" />
                                <input type="hidden" name="startpic" value="$startpic" />
                                <input type="hidden" name="updatetype" value="$updatetype" />
                                <input type="hidden" name="albumid" value="$albumid" />
                                <input type="hidden" name="autorefresh" value="$autorefresh" />
                                <input type="submit" value="{$lang_util_php['continue']}" class="button" />
                </form>
EOT;
}
        }
else echo $lang_util_php['finished'];
}

function deletbackup_img()
{
        global $CONFIG, $lang_util_php;

        $albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;
        $albstr = ($albumid) ? "WHERE aid = $albumid" : '';

        $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} $albstr");
        $num = mysql_num_rows($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("Success".$lang_util_php['main_success'], $back);
                print '!<br>';
}
            } else {
                printf("Error".$lang_util_php['error_rename'], $back);
            }
        ++$i;
    }
}



find


        'del_orphans' => array('del_orphans', $lang_util_php['delete_orphans'], $lang_util_php['delete_orphans_explanation']),

below add


        'deletbackup_img' => array('deletbackup_img', $lang_util_php['delete_back'], $lang_util_php['delete_back_explanation']),


Stramm

-delete.php
find

function output_table_header()
{
    global $header_printed, $need_caption, $lang_delete_php;

    $header_printed = true;
    $need_caption = true;

echo <<<EOT
<tr>
<td class="tableh2"><b>{$lang_delete_php['npic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['fs_pic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['ns_pic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['thumb_pic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['comment']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['im_in_alb']}</b></td>
</tr>
EOT;
}

function output_caption()
{
    global $lang_delete_php
    ?>
<tr><td colspan="6" class="tableb">&nbsp;</td></tr>
<tr><td colspan="6" class="tableh2"><b><?php echo $lang_delete_php['caption'?></b></tr>
<tr><td colspan="6" 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>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>
<?php
}

and replace with

function output_table_header()
{
    global $header_printed, $need_caption, $lang_delete_php;

    $header_printed = true;
    $need_caption = true;

echo <<<EOT
<tr>
<td class="tableh2"><b>{$lang_delete_php['npic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['fs_pic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['ns_pic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['orig_pic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['thumb_pic']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['comment']}</b></td>
<td class="tableh2" align="center"><b>{$lang_delete_php['im_in_alb']}</b></td>
</tr>
EOT;
}


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>
<?php
}


find

    $files = array($dir . $file, $dir . $CONFIG['normal_pfx'] . $file, $dir . $CONFIG['thumb_pfx'] . $file);

replace with

    $files = array($dir . $file, $dir . $CONFIG['normal_pfx'] . $file, $dir . $CONFIG['orig_pfx'] . $file, $dir . $CONFIG['thumb_pfx'] . $file);



find

        starttable("100%", $lang_delete_php['del_pic'], 6);
        output_table_header();
        $aid = delete_picture($pid);
        output_caption();
        echo "<tr><td colspan=\"6\" class=\"tablef\" align=\"center\">\n";

replace with

        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";



editpics.php
find

                        $files=array($dir.$file, $dir.$CONFIG['normal_pfx'].$file, $dir.$CONFIG['thumb_pfx'].$file);

replace with

                        $files=array($dir.$file, $dir.$CONFIG['normal_pfx'].$file, $dir.$CONFIG['thumb_pfx'].$file, $dir.$CONFIG['orig_pfx'].$file);


searchnew.php
find

            if (strncmp($file, $CONFIG['thumb_pfx'], strlen($CONFIG['thumb_pfx'])) != 0 && strncmp($file, $CONFIG['normal_pfx'], strlen($CONFIG['normal_pfx'])) != 0 && $file != 'index.html') {

replace with

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


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

if you want to have the 'automatically downsize watermark on small images' functionality go here http://forum.coppermine-gallery.net/index.php?topic=29817.msg143122#msg143122
(just a minute of extra work and well worth it ;) )

freesouljah

hey bro, what do I need to change to get the auto process mod you built for util.php to work with 1.4x

thanks man....keep up the excellent work  8)

Stramm


freesouljah

Quote from: Stramm on April 02, 2006, 10:44:44 AM
it's 'built in' in the above hack

::) I guess I should have read your post completely before asking...  :-X

thanks

Ross(SE-MI)

Great job on this mod Stramm. :)
Working very good on my site.
Thank You

woodysfj40

I received the following error...redid the hack to this file, and the error still occurs....

Parse error: syntax error, unexpected '}' in /home/gallery/searchnew.php on line 264

your replacement code needs to include the final '{' in that line...

Stramm


ISBB

Another MasterPiece Strahm.. Works wonders on my site... But for future modifications to this mod it would be cool to have 2 diff size watermarks like the Plugin offers...   A smaller one for the Intermediate pictures and the regular sized one for the Originals...

But im very pleased as the mod went smoothly and without issue.. :D  Thx for the hard work bud!!
Its gaurunteed.. until it breaks

Lifted trucks are like boob jobs, no matter what size shape or dimension they are always fun to look at.

Stramm

Quote from: ISBB on April 20, 2006, 05:02:51 AM
Another MasterPiece Strahm.. Works wonders on my site... But for future modifications to this mod it would be cool to have 2 diff size watermarks like the Plugin offers...   A smaller one for the Intermediate pictures and the regular sized one for the Originals...

But im very pleased as the mod went smoothly and without issue.. :D  Thx for the hard work bud!!

yup, nice idea, should be easy to do

Farsider

Stramm

Think i'm missing something here. 

I have created a file called watermark.png and have tried referencing it with full path as well as the default "images/watermark.png".
I have applied the mod, modified all the relevent pages, run the update and enabled the Watermark option in the config.  I have run the admin tools to update images, tried uploading fresh images via the "File Upload" and "Batch Add" but none of my images seem to be getting a watermark applied and no errors seem to have been thrown up anywhere.  I'm sure it is one of those idiot errors on my behalf but im sure I will not be the only one to full into the trap I am in.

Let me take the time to commend you and the team with the great work you have done with coppermine.

Stramm


Jarvhix

 :'(

Hi, I tried the code and have everything added and edited as stated and I get this error when I try to run the refresh in (admin tools)

Updating thumbnails and/or resized images, please wait...
ERROR creating:$thumb
ERROR creating:$image
ERROR creating:$thumb
ERROR creating:$image
ERROR creating:$thumb
ERROR creating:$image
ERROR creating:$thumb
ERROR creating:$image
ERROR creating:$thumb


and then I can't upload an image. It doesn't upload at all. When I run the upload it says:

The previous file could not be placed.

You have successfully placed all the files.


and the image is not uploaded to it's requested destination.

Stramm

properly chmod folders and files.. that's especially important if you upgraded.
Reason, now the images get modified and saved again, and that's doing php/ GD2. When you initially uploaded it was apache/ http upload. -> if both run under different users you then group or anon write permissions arte necessary

-> 666 files, 777 folders


Jarvhix


Stramm

777 albums folder and its subfolders
666 all files in the albums folder and its subfolders

I assume you properly applied the mod... make sure bedore strating to chmod. First chmod folders, test, then chmod files

Jarvhix

Thanks. Yes, the Albums folder is already 777 as well the sub-folders. There are only two files each, in the Edit folder, and the Userpics Folder : index.php and no-FTP-upload file.


Are the files from the main directory to be 644 or 666 also?

Stramm

nothing else needs chmodding except (if you upgarded from 1.3 to 1.4) the files and folders in the albums dir (as already said)

you said the admin tools spit out
Updating thumbnails and/or resized images, please wait...
ERROR creating:$thumb
ERROR creating:$image

--> you've files in the albums dir or its subdirs
usually you get that when coppermine finds a non image file (a movie, pdf etc) that gd2, ImageMagick can't handle. Standard behaviour

Double check if you followed the instructions

Jarvhix

Uh-oh, now I'm confused. Check what instructions? I don't have any movies or pdf in the albums folder. Only images in the userpics folder and a folder for batch uploading. But they are all chmod accordingly. I asked about the main files because I noticed that they are not all the same chmod. Some of the files in the main directory of coppermine, are 644 and some are 666