forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: alexandre596 on March 26, 2012, 01:19:29 am

Title: delete thumbs and update thumbs an resized images automatically?
Post by: alexandre596 on March 26, 2012, 01:19:29 am
I don't even know if it's possible..

well, everytime everybody upload a picture, the thumb and the resized pictures won't be watermaked , the full-size will be, and the original one (the one without watermark) will remain on the server, right?

I wanted to watermark the thumbnail and the resized picture too, and delete that original picture as well just after the picture get in my coppermine gallery...

Everytime I upload a picute I have to go to Admin Tools (or something like that, mine coppermine is not english), and check that option to delete the original picture, and after that is done, I go to that option to update the thumbs and the resized images on my album

is there any plugin to do all this automatically after I upload the pictures??

Title: Re: delete thumbs and update thumbs an resized images automatically?
Post by: Αndré on March 26, 2012, 02:16:02 pm
To apply the watermark to the intermediate-sized pictures, just set it accordingly in the config: http://documentation.coppermine-gallery.net/en/configuration.htm#admin_watermarking_filetype

To apply the watermark to the thumbnails there's a mod if I remember correctly. The following mod may work, but I haven't checked that. Open include/picmgmt.inc.php, find
Code: [Select]
if (($result = resize_image($work_image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false", 1)) !== true) {and replace with
Code: [Select]
if (($result = resize_image($work_image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "true", 1)) !== true) {
Instead of deleting the backup files we can modify the code, so it won't create them at all. Open include/picmgmt.inc.php, find
Code: [Select]
        // create backup of full sized picture if watermark is enabled for full sized pictures
        if (!file_exists($orig) && $CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original'))  {
            if (!copy($image, $orig)) {
                return false;
            } else {
                $work_image = $orig;
            }
        }
and delete the whole block.
Title: Re: delete thumbs and update thumbs an resized images automatically?
Post by: alexandre596 on April 05, 2012, 09:56:50 pm
sorry for don't reply, I was waiting for an email, or something

well, I've got what I wanted, but in a different way

I deleted that thing about creating the original, and then, I found on that code, where the watermark thing is


Code: [Select]
        // watermark full sized picture
        if ($CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')) {
            $wm_max_upl_width_height = $picture_original_size ? max($imagesize[0], $imagesize[1]) : $CONFIG['max_upl_width_height']; // use max aspect of original image if it hasn't been resized earlier
            if (($result = resize_image($work_image, $image, $wm_max_upl_width_height, $CONFIG['thumb_method'], 'any', 'true')) !== true) {
                return $result;
            }
        }
    } else {
        $imagesize[0] = $iwidth;
        $imagesize[1] = $iheight;
    }

so, I moved the creating thumbs and intermadiate pictures after it, not before as it used to be, and now it do exactly what I want it to do

thank you so much ;D