Advanced search  

News:

cpg1.5.42 maintenance release - upgrade recommended
The Coppermine development team is releasing an update for Coppermine in order to fix several minor issues. All fixes are not security critical, so if your gallery is running fine with cpg1.5.36, cpg1.5.38 or cpg1.5.40 you don't need to upgrade. If you are running an older version than cpg1.5.36, you must update to this latest version as soon as possible because of the security impact!
[more]

Pages: [1]   Go Down

Author Topic: Problem with watermark  (Read 3285 times)

0 Members and 1 Guest are viewing this topic.

lunaclems

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Problem with watermark
« on: May 17, 2015, 12:31:05 PM »

Hello,

I work with Coppermine 1.5.36. I uploaded many pictures (near 7,000) with a watermark. But now I would like to change it or at least remove it. In my config, I removed the watermark but when I go to utility and I try to update the pictures (all, resized or original), the orig_picture.jpg is deleted, and I have the picture.jpg with the watermark not removed.

I would like to replace the "picture.jpg" by the orig_picture.jpg without delete the original picture.

Can someone help me please because it's driving me crazy and I'm loosing a lot of time since about one or two years !

Thanks a lot

For example : http://pictures.katie-melua.org/thumbnails.php?album=637
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1281
Re: Problem with watermark
« Reply #1 on: May 17, 2015, 04:28:20 PM »

The intermediare picture is normal_image.jpg, the thumnails is thumb_image.jpg and the full size (pop up) is image.jpg. orig_image.jpg is created only when you use the watermark. Is a backup for you when you decide not to use the watermark anymore. Once watermak is disabled and you use Admin Tools to update all, the orig_image.jpg gets deleted as is no longer needed. orig_image.jpg is just a copy of image.jpg without watermark that coppermine creates when you use the watermark. Coppermine needs orig_image.jpg to create image.jpg without watermark (when you decide you don't want your images to be watermarked anymore) and then deletes it.

If you decide to use the watermark again then use Admin Tools to update all and the orig_image.jpg will be created again.

To use a custom watermark replace watermark.png from the images folder of your coppermine gallery with your custom watermark image.
« Last Edit: May 17, 2015, 05:04:32 PM by allvip »
Logged

lunaclems

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Problem with watermark
« Reply #2 on: May 17, 2015, 06:16:14 PM »

Thank you a lot for your answer. I got the point for the first part!

Quote
Coppermine needs orig_image.jpg to create image.jpg without watermark (when you decide you don't want your images to be watermarked anymore) and then deletes it.

But, there's a problem...
When I update the album containing watermarked images, coppermine deletes orig_image.jpg (ok for that) but the image.jpg is still watermarked. For me, it's nonsense...
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1281
Re: Problem with watermark
« Reply #3 on: May 17, 2015, 08:16:30 PM »

Maybe coppermine dev team can help you because it happens to me too.
I want to Config - Watermark images - disable it then Admin Tools - Update thumbs and/or resized photos - Just full sized (if an original copy is available) or Both resized and full sized (if an original copy is available) and that deleted my orig_image.jpg and the image.jpg is still watermarked. I cleared the cokie.

ATTENTION without orig_image.jpg you can not restore the images.
Wait for an answer from coppermine dev team.
« Last Edit: May 17, 2015, 08:23:22 PM by allvip »
Logged

lunaclems

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Problem with watermark
« Reply #4 on: May 17, 2015, 10:17:03 PM »

Maybe coppermine dev team can help you because it happens to me too.
I want to Config - Watermark images - disable it then Admin Tools - Update thumbs and/or resized photos - Just full sized (if an original copy is available) or Both resized and full sized (if an original copy is available) and that deleted my orig_image.jpg and the image.jpg is still watermarked. I cleared the cokie.

ATTENTION without orig_image.jpg you can not restore the images.
Wait for an answer from coppermine dev team.

Yes, a chance that I kept a copy of original images on my pc... But it's a MESS!!!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15089
Re: Problem with watermark
« Reply #5 on: May 29, 2015, 10:23:11 PM »

Have you cleared your browser cache after you used the admin tools? Maybe it's a bug, but I've currently no possibility to test it myself.
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1281
Re: Problem with watermark
« Reply #6 on: May 30, 2015, 09:56:10 PM »

Have you cleared your browser cache?

I have coppermine on my PC. I opened the image with windows photo gallery. Is watermarked and orig_image.jpg was deleted.
Admin Tools can watermarks unwatermarked images and create orig_image.jpg, but can not unwatermark the images.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15089
Re: Problem with watermark
« Reply #7 on: June 01, 2015, 10:06:12 PM »

Confirmed. Patch proposal:
Code: [Select]
Index: util.php
===================================================================
--- util.php (revision 8783)
+++ util.php (working copy)
@@ -447,14 +447,18 @@
             if ($updatetype == 3 || $updatetype == 4 || $updatetype == 5) {
                 // resize full-sized picture without watermark (will be applied later) if it's bigger than the max width or height for uploaded pictures
                 if (max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']) {
-                    if ((USER_IS_ADMIN && $CONFIG['auto_resize'] == 1) || (!USER_IS_ADMIN)) {
-                        // skip resizing for admin if not set to "everyone"
-                        $resize_method = $CONFIG['picture_use'] == "thumb" ? ($CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use']) : $CONFIG['picture_use'];
-                        if (resize_image($work_image, $image, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $resize_method, 'false')) {
-                            $imagesize = cpg_getimagesize($image);
-                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $image . "</tt> " . $lang_util_php['updated_successfully'] . '!</td></tr>';
+                    $resize_method = $CONFIG['picture_use'] == "thumb" ? ($CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use']) : $CONFIG['picture_use'];
+                    if (resize_image($work_image, $image, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $resize_method, 'false')) {
+                        $imagesize = cpg_getimagesize($image);
+                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $image . "</tt> " . $lang_util_php['updated_successfully'] . '!</td></tr>';
+                    } else {
+                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $image . '</tt>!</td></tr>';
+                    }
+                    if (file_exists($orig)) {
+                        if (copy($image, $orig)) {
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $orig . "</tt> " . $lang_util_php['updated_successfully'] . '!</td></tr>';
                         } else {
-                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $image . '</tt>!</td></tr>';
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $orig . '</tt>!</td></tr>';
                         }
                     }
                 }
@@ -491,25 +495,38 @@
 
             if ($updatetype == 3 || $updatetype == 4 || $updatetype == 5) {
                 if ($CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')) {
-                    // update/create backup of full sized picture if watermark is enabled for full sized pictures
-                    if (copy($image, $orig)) {
-                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $orig . "</tt> " . $lang_util_php['updated_successfully'] . '!</td></tr>';
+                    if (!file_exists($orig)) {
+                        // create backup of full-sized picture if doesn't exist
+                        if (copy($image, $orig)) {
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $orig . "</tt> " . $lang_util_php['updated_successfully'] . '!</td></tr>';
+                            $backup_file_exists = true;
+                        } else {
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $orig . '</tt>!</td></tr>';
+                            $backup_file_exists = false;
+                        }
                     } else {
-                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $orig . '</tt>!</td></tr>';
+                        $backup_file_exists = true;
                     }
-                    // watermark full sized picture
-                    $wm_max_upl_width_height = (max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']) ? max($imagesize[0], $imagesize[1]) : $CONFIG['max_upl_width_height']; // use max aspect of original image if it hasn't been resized earlier
-                    if (resize_image($work_image, $image, $wm_max_upl_width_height, $CONFIG['thumb_method'], 'any', 'true')) {
-                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $image . "</tt> " . $lang_util_php['updated_successfully'] . '!' . '</td></tr>';
-                    } else {
-                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $image . '</tt>!</td></tr>';
+                    if ($backup_file_exists) {
+                        // watermark full-sized picture
+                        $wm_max_upl_width_height = (max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']) ? max($imagesize[0], $imagesize[1]) : $CONFIG['max_upl_width_height']; // use max aspect of original image if it hasn't been resized earlier
+                        if (resize_image($work_image, $image, $wm_max_upl_width_height, $CONFIG['thumb_method'], 'any', 'true')) {
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $image . "</tt> " . $lang_util_php['updated_successfully'] . '!' . '</td></tr>';
+                        } else {
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $image . '</tt>!</td></tr>';
+                        }
                     }
                 } elseif (file_exists($orig)) {
-                    // backup picture isn't needed but exists - delete it
-                    if (unlink($orig)) {
-                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . sprintf(str_replace('%s', '<tt>%s</tt>', $lang_util_php['del_orig']), $orig) . '!</td></tr>';
+                    // remove watermark from full-sized picture and delete backup file
+                    if (copy($orig, $image)) {
+                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . '<tt>' . $image . "</tt> " . $lang_util_php['updated_successfully'] . '!</td></tr>';
+                        if (unlink($orig)) {
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['ok'] . sprintf(str_replace('%s', '<tt>%s</tt>', $lang_util_php['del_orig']), $orig) . '!</td></tr>';
+                        } else {
+                            echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . sprintf(str_replace('%s', '<tt>%s</tt>', $lang_util_php['del_error']), $orig) . '</td></tr>';
+                        }
                     } else {
-                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . sprintf(str_replace('%s', '<tt>%s</tt>', $lang_util_php['del_error']), $orig) . '</td></tr>';
+                        echo '<tr><td class="'.$tablestyle.'">' . $icon_array['stop'] . $lang_util_php['error_create'] . ': <tt>' . $image . '</tt>!</td></tr>';
                     }
                 }
             }
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1281
Re: Problem with watermark
« Reply #8 on: June 02, 2015, 12:07:06 AM »

I only know to apply a patch manually so I opened util.php, and I start editing. I know the lines marked with - must be deleted and the lines marked with +  must be added.

Watermark and unwatermark images with Admin Tools works great now.


Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15089
Re: Problem with watermark
« Reply #9 on: June 03, 2015, 08:43:26 PM »

Fix committed in SVN revision 8784.
Logged
Pages: [1]   Go Up
 

Page created in 0.083 seconds with 20 queries.