Member
Member
Epsilon   2016-04-27, 05:33
#1

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.

Administrator
Administrator
acrylian   2016-04-27, 08:12
#2

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.

Member
Member
Epsilon   2016-04-28, 03:35
#3

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

Administrator
Administrator
acrylian   2016-04-28, 09:23
#4

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

Administrator
Administrator
fretzl   2016-04-28, 11:28
#5

You could also use something like this:

makeImageCurrent($_zp_current_album->getAlbumThumbImage()); echo $_zp_current_image->webpath;
This uses the [i]webpath[/i] property of the image object and gets you the webpath to the full image without any watermark.

Member
Member
Epsilon   2016-04-29, 02:17
#6

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

Administrator
Administrator
acrylian   2016-04-29, 13:50
#7

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.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.