"Image size" option not working

I think I don't know what the option is for, actually.

What I want to do is to limit all images that are uploaded so that no image is wider than, say 600 px . How do I do that? The "Image size" option in Options > "image display" seems to have no effect on the images. I want them to be at most 600 px wide when the visitor clicks them and the lightbox appears.

Comments

  • The image size option works for "image pages" (`image.php`). Since you mention lightbox, I am assuming that you are not using a theme that links to the image page. You would have to tell us which theme you are using for any more help.
  • Thanks for your quick reply! I'm currently using Simple+ so there's the reason for this problem.

    The options are to 1) get help from you guys how to activate that image.php or 2) to change my theme.
  • acrylian Administrator, Developer
    The lightbox (actually it's slimbox) within simple+ uses the full size image to display. This is the image you uploaded.
    Try replacing `getFullImageURL()`with `getSizedImageURL()`around line 71-77 on the theme's album.php
  • Thanks for your reply, acrylian!

    I understand that changing that line will take the resized image and display it instead of the original large one.

    Unfortunately, it seems I have no resized images... changing that line caused my lightbox (slimbox :) to not find the image.

    In the album folder, there is only the original (large size) image and no resized image. I only have one image upploaded in that album.

    I wonder why my zenphoto doesn't resize the images that I upload...? I have set "Protect full image" to false and "Full image download" to false.
  • acrylian Administrator, Developer
    Sorry, I didn't test the above solution and made just a quick guess. Indeed that seems not to work...

    Zenphoto does resize images for the thumbs and the sized image that is only used if you use the image.php page (which this theme does not do) and someone visits the image or if you use the precache buttons in the admin.

    If you want to use the simple+ theme without modifing you would have to resize your images before uploading.
  • I have a working knowledge of JavaScript and PHP, altough I have no insight in the zenphoto class hierarchy.

    Maybe I can make the slimbox load image.php?id= and provide the image content-type?

    Or is there a simpler solution?
  • acrylian Administrator, Developer
    If slimbox is able to open pages (thickbox can for example), you could call the image.php you would have to create one for the theme by modifying one from default theme for example first with this:
    without mod_rewrite: `zenphoto/index.php?album=&image=`
    with mod_rewrite: `zenphoto//` +mod-rewrite suffix set in options.

    Please take a look at default theme for example.
  • Sorry, I know nothing of mod_rewrite as I don't use an Apache server. Also, iframes are deprecated, even if it's in a slimbox I don't like the solution.

    I have a better idea. Is there a way to retrieve the cached (resized) image URL? You mentioned `getSizedImageURL(595)` but that didn't work (empty output). What if I could get the URL to the cached resized image? Like `zenphoto/cached/album__image.jpg_595.jpg` ? Then I could just make sure to cache the images I upload?

    Maybe I can even take that cache function (that image.php must be using) and call it from album.php to make it cache automatically?
  • acrylian Administrator, Developer
    If you precache the images in the admin you should get images like that above mentioned. Actually `getSizeImageURL()`should get the url to that image (if the values within the brackets is left empty the size set in the options is taken).
    Any you can called that directly, too: `zenphoto/zp-core/i.php?a=&i=&s=`

    instead of "zenphoto" and "zp-core" you could use the constants WEBPATH and ZENFOLDER.
  • O-kay... then you have another version of zenphoto than me, 'cause in my template-functions.php the getSizedImageURL is defined like this:
    `function getSizedImageURL($size) {

    getCustomImageURL($size);

    }`

    An optional parameter had been like `function getSizedImageURL($size = 0) { }`
  • acrylian Administrator, Developer
    Shame on me, I indeed confused it with `getDefaultSizedImage()` (we have too many functions, that happens if you answer inbetween...:-)). But you could use `getSizedImageURL()`with the option setting of the admin with this `getSizedImageURL(getOption("image_size"))`

    Please take a look at our functions guide, too.
  • `getSizedImageURL(getOption("image_size"))` also returns nothing in the href attribute. Empty string.

    Do you have any idea why I have no SizedImageURL for my images...? Didn't get any URL with `getSizedImageURL(595)` either so it has nothing to do with getOption.
  • Yes, `getDefaultSizedImage()` worked! :D Thanks a bunch!

    Now I've modified my Simple+ theme to work with PHP safe_mode On and displaying the cached image from the albums instead of the original ones. It seems to be caching the images automagically too.

    A last question for you; will I have to cache any images that I upload now? I just tried uploading an image and directly checking it out in the gallery, without precaching, and it worked fine. Will this fix stay in effect and work in the long run? Is it a huge server burden or won't work with uploading zip archives or anything like that?
  • acrylian Administrator, Developer
    zenphoto always caches automatically once if someone visits an image the first time (both thumbs and the sized image). If you don't change the size in the options for thumbs or the size image, nothing more will happen.

    Additionally you have the option to cache manually either all images (on overview in the admin) or for each album individually (on the album's edit page in the admin).
  • Hello.. please can you give me the solution? send me the image.php file or something like that...? i'm also have this problem.

    thanks.
Sign In or Register to comment.