Get Album Thumb Without Watermark

Hi

When browsing an album I have a "banner" that contains the album's details (title, tags, description etc.) positioned at the top of the page. This banner uses a custom sized version of the albums thumbnail as a background image.

I have the gallery setup to use watermarks for all of the images, however for the banner I would like to use a background image that does not have a watermark.

Is there a way to retrieve the current albums thumbnail (with a custom size) that does not have a watermark?

Currently I use this code to retrieve the thumbnail:

`getCustomAlbumThumb(1200)`

P.s. I tried to check the documentation on this site (specifically the guides for "template Functions", "functions.php" and "functions-basic.php") but I get a 403 Forbidden error message.

Comments

  • acrylian Administrator, Developer
    Sorry, about the doc issue but something is not right on our server for yet unknown reasons.

    All "thumb" named image functions should not return a watermark. As far as I can see it is setup correctly. Did you try clearing the cache?

    We have to try to reproduce this.

    Alternatively you could try:
    `getCustomImageURL(1200, null, null, null, null, null, null, true)`

    While the doc is not working correctly, you can get the same function information directly from `zp-core/template-functions.php` and the function comments. The doc is generated from these anyway.
  • Thank-you for the tip about the function comments, I will check them out and see what I can find.

    I have tried purging the image cache using cachemanager plugin and have also cleared my browser cache.

    Currently I have "image thumbnails" in the Zenphoto options set to use watermarks. If I disable this option the banner doesn't have the watermark, however none of the other thumbnails do either. I would really like to override the watermark option just for the banner background instead of disabling the watermarks on all thumbnails.

    Initially `getCustomImageURL()` returned nothing. If I set the current image to be the album's thumb using `makeImageCurrent()` and then call `getCustomImageURL()` it returns the album thumb. Unfortunately it still has the watermark. The exact code I used is:

    `makeImageCurrent($_zp_current_album->getAlbumThumbImage());`

    `getCustomImageURL(1200, NULL, NULL, NULL, NULL, NULL, NULL, TRUE);`
  • acrylian Administrator, Developer
    That would be correct behaviour. `$thumbStandin = true` makes the image generated internally a "thumb". So if sized images had watermarks, thumbs would not, unless you set the option as you did. That watermark option is global and cannot directly be overriden.

    You could try to temporarily reset the option right before the image function calls:
    `setOption('Image_watermark', 0, false); // watermark options are named a bit confusingly for unknown reasons… The uppercase "I" is not a typo.`

    Then after the images reset it again `setOption('Image_watermark', 1, false);`
  • fretzl Administrator, Developer
    You could also use something like this:

    `
    makeImageCurrent($_zp_current_album->getAlbumThumbImage());
    echo $_zp_current_image->webpath;
    `
    This uses the webpath property of the image object and gets you the webpath to the full image without any watermark.
  • I tried to use `setOption()` before printing out the image and then directly after that set it back. Unfortunately this didn't work for me and all of the thumbnails were still printed with the watermark.

    I echoed the value of "Image_watermark" before and after using the `setOption()` function and the option was set successfully so I'm not sure why the images printed between the two `setOptions()` had the watermark.

    The code I used for testing is below ("image thumbnails" in the Zenphoto options is set to use a watermark):

    `$defaultWatermark = getOption('Image_watermark');`

    `echo 'Global Value: ' . getOption('Image_watermark') . '
    ';`

    `setOption('Image_watermark', 0, false);`

    `echo 'New Value: ' . getOption('Image_watermark') . '
    ';`

    `printCustomAlbumThumbImage(NULL, 1000);`

    `setOption('Image_watermark', "$defaultWatermark", false);`

    `echo '
    Reset Value: ' . getOption('Image_watermark') . '
    ';`

    Getting the full image webpath works but some of the images are a bit too large (filesize) to use on the page.

    I think I will just leave it as it is. Thank-you very much for your suggestions, I really appreciate the help :)
  • acrylian Administrator, Developer
    You may have to try `setOption('Image_watermark', 0, true)` to set it persistently before the functions and then reset it persistently again afterwards. Not all options respectively all functions work if the option is changed temporarily if they already called the value naturally. Don't remember that offhand for these.

    Another way would be to:
    - Disable watermarks on thumbs globally and keep it enabled on the sized images
    - Then the albumthumb would not have one
    - If other thumbs should, use the customsize functions instead of thumb functions, It's technically the same image processing as thumb vs sized image is just an internal thing basically.
Sign In or Register to comment.