Image Watermarking Revisited

OK. So I have watermarking working in my new theme here.

Currently, everything but the images set to display as size=thumb will add the watermark. I know why it does this, by this added line in i.php:

`if ($perform_watermark == true && $thumb == false) {`

How can I structure the line more "effectively" to compensate for custom image thumbs, etc without greatly affecting the code? In other words, what is the best way to structure the if-then statement to only watermark the images displayed in the image.php context.

Does that make sense?

Comments

  • For example:

    `if ($perform_watermark == true && $thumb == false && $height > 180) {`

    won't seem to generate any thumbnails with watermarks. Syntax looks correct, but I'm not sure.

    What I'm trying to reason out that if any thumbs are generated below a certain height and width that it won't plop a watermark down on the image. Does this sound like the right way to proceed? It's very difficult to make sense of it because if the theme uses custom thumbs, etc. it is difficult to say what is an image, and what is a custom thumb.

    Hmmm.
  • I tried this as well:

    `if ($perform_watermark == true && $thumb == false && $size == $image_default_size) {`

    Which again, doesn't generate any watermarks at all.

    Double Hmmm.
  • Ah, but there is a fly in the ointment. It seems with the above statement, it does generate with watermarks, but only if the original image is 595 or greater in size (the default for zp_conf). So images that are below 595 in size don't get watermarks.

    Now I'm getting it. I'm doing this as a "live debugging" (which evidently is all the rage on Web 2.0 blogs right now) in case it helps someone else in determining how it all works, besides Tristan - he knows it all. ;)
  • trisweb Administrator
    Pass in an extra argument (like `i.php?i=i.jpg&a=alb&s=595&watermark`), and use it when requesting images you want watermarked. You can modify the template function if you like to only use it when in the image context.
  • That's a nifty idea. Thanks Tris.
  • @ thinkdreams:

    I’ve to say that it took me about 1 minute to find a bug with your image rating system,
    so, it allowed me to vote for any image as many times as I like..
    See: http://www.bushwoodworking.com/zenphoto/cache/artists/comptone/drum3.jpg_100_cw85_ch85.jpg... The first 14 votes are mine.

    Good luck!
    And, greetings from Russia ;)

    P.S.:

    @ trisweb: respect ;)
  • @Nordelius

    It's not really my rating system, I didn't actually code the plugin, just gleaned the implementation from the forum. I would appreciate however knowing how you managed to find the bug, as I'd like to fix the problem in the hack. Not that I mind if someone wants to vote for an image 14 times, but this might be a useful bugfix for everyone on the forum who might want to use this hack.

    Thanks for pointing this out!

    And if you want a snare drum - I know the guy who makes 'em! ;)
  • I am getting the watermark on my thumbs on the main page. Where and which line do I use and what file do I put it in to stop this?

    thanks
  • trisweb Administrator
    Are we talking about thinkdreams' theme, or Zenphoto in general?

    Zenphoto does not add watermarks to any images out of the box unless you've made customizations or are using a new i.php file.
  • I am using andrey, but i modded based on the hack files.

    I saw the line for thumbs = false and i have that.

    thanks
Sign In or Register to comment.