More protection for images

Hi there,

first of all: Great gallery system. I tried several systems, and was an user of another system for a long time, but at least Zenphoto fits my needs perfectly! So thanks for this!

But here is my problem: I want to watermark all of my images, this works, but i dont want to give access by replacing

`http://example.com/albumname/image.jpg.htm?p=*full-image`

with

`http://example.com/albums/albumname/image.jpg`

Therefore i created an .htaccess file with a very simple rule

`Order Deny,Allow

Deny from all

Allow from 127.0.0.1`

which works perfect, but there is a problem while using images lower sized than the max image size setting (Options -> image display -> Image size). By whatever it does, it does not create a cached version (including the watermark already) of this image, and therefore i get a "403 - forbidden", because, it wants to use the actual image as preview.

The according part of my skin for the images previews is

`<?php printDefaultSizedImage(getImageTitle(), 'imagepreview'); ?>`

My question is: What do i have to change, that the system will ALWAYS generate a cached version, and NEVER delivers the actual image?

Comments

  • This is just a quick look/suggestion, so it might not work.

    in i.php you will find some code
    ` // If the requested image is the same size or larger than the original, redirect to it.

    if (!$upscale && $newh >= $h && $neww >= $w && !$crop) {

    header("Location: " . getAlbumFolder(FULLWEBPATH) . pathurlencode($album) . "/" . rawurlencode($image));

    return;

    }`

    I believe that if you just delete this you will get the image cached/watermarked. However, it may also get resized. I will look more into this.

    Perhaps you should keep the if statement and replace the `header` and `return` with `$newh = $h; $neww=$w;`
  • I have tried this change and it works. It also fixes a problem, so I will add it to the release, should be in tonight's build.
  • Well, as a first, crude, hack, it works partially :) It will resize the image to the max width value, and only delivers the resized version (which is upscaled) resized via HTML to the actual file measurements, if i remove the statement.

    If i just remove its contents and replace it with `$newh = $h; $neww=$w;`, it works like charm!

    Thanks. Maybe you could make it an option in the next final version? :)

    Btw: Is there a reason, i dont understand, that the watermark is in the bottom right corner (0,0 from bottom right) at the preview image, and at the botom right corner _plus_a_few_pixels_ (20,20 from bottom right) in the full image?
  • I don't know of a reason. What would you like for the positioning?
  • *dream* I'd like define the position by myself by selecting a combination of the "base positions" (top, left, right, bottom, center; i.e.: top-left oder bottom-center). the padding to the edge of the image should be 0 pixels. if i want to have a padding, i'd like to create my watermark according to the padding i want ... well, you asked for what i want ;)

    in real i'd be happy with a consistent positioning in the full image and the preview, somewhat around 10 pixels padding (because the 10 pixels are fit to my design *g*) :)
  • How about an offset from the top left. That will be in tonight's build. You will be able to specify a percentage of the "space" available for the watermark. 0% is top left, 100% is bottom right.

    And, the positioning will be the same for full image.
  • Well, this sounds nice. Im not a nightly fan, but if this is in the nex final, i can wait ;) Thanks!
  • Edit (why cant i edit my previous post?): I changed my mind! The new nightly rocks! Thanks!
Sign In or Register to comment.