rectangular thumbnails?

I just upgraded from an aging copy of Zenphoto and discovered that it seems to only want to do square thumbnails. Which is a problem, because my entire site design is built around rectangular thumbnails.

How can I fix this?


  • acrylian Administrator, Developer
    You have to modify your theme to use "customimage" functions. Info on the function documentation.
  • As far as I can see, doing this would hardwire particular crop locations into the theme.

    There is no standard size or aspect ratio for my art, and thumbnails were cropped arbitrarily to suit my sense of aesthetics.

    Why was this functionality removed? I now need to either redesign my site around machine-chosen square thumbnails (ugh), switch to another gallery package and import the old Zenphoto data (double ugh), or roll back to an old, insecure version of Zenphoto (triple ugh). If I was selecting a gallery package right now, ZP's refusal to let me choose the size and content of my thumbnails would rule it right out.
  • I'm not sure what you want to do exactly?
    I understand that your art has different sizes. Do you want all photos in a given album to also appear on the album page at different sizes? Or do you want all of them them to be shrunk into a given rectangle (say 200 px x 120 px)?

    All of these can be done, and as far as I know, no possibilities have been removed from v.1.2 (at least).

    If you want to see for yourself, I have an example of rectangular thumbnails here (not perfect, I need time to finetune my theme). It runs on v.1.4.3:
    I could also have made the album thumbnails rectangular. I preferred to keep some place for the description.
  • acrylian Administrator, Developer
    You can really choose rectangular thumb sizes and they don't even need to be cropped. Nothing has been removed. There are options for that. That requires that the theme used does support those otherwise you have to modify the theme using custom image functions directly.
  • Okay, here's what I want to do.

    Let's say I've designed the site around 200x100 thumbnails. And I want to crop each image individually, to highlight some part of it for the thumbnail - say a face, a hand, whatever.

    Image 1 might be 1200x4000, with a thumbnail scaled down from a 600x300 rectangle whose upper left corner is at 497, 332.

    Image 2 might be 673x490, with a thumbnail scaled down from a 448x224 rectangle whose upper left corner is at 45,0.

    And so on and so forth. Images and their thumbnail crop rectangles will vary; the only thing that's consistent is that all of the crop rectangles will have the same aspect ratio as the thumbnails, so they can all be scaled to the same size.

    Each of these croppings, of course, would have been chosen interactively with the thumbnail cropper.

    But now all the thumbnail cropper will do is select square images.

    I used to be able to go to the theme settings and put a thumbnail width and height in. Now there's just one value, that's used for both.

    Where will I find the options for doing this? How do I make a theme support this? Can you point me to a theme that actually does this so I can have a working example?
  • The thumb cropper is conditioned to preserve the thumbnail aspect ratio. So If your theme defines thumbnails to be square the cropper will allow only square crops.

    You can try setting the ratio via the crop theme settings. 0% from the left and 25% from the top will give you a 200x100 aspect ratio.
  • I just tried dinking with the default theme. Went into themeoptions.php and changed some stuff:

    setThemeOptionDefault('thumb_size', 256);
    setThemeOptionDefault('thumb_crop_width', 256);
    setThemeOptionDefault('thumb_crop_height', 128);

    Absolutely no change - the thumbnail cropper still gives me square thumbs. Am I looking in the wrong place?
  • Well, of couse there would be no change. Setting option defaults once they have obtained a value will do absolutely nothing. That is the whole point behind the function.

    On the options page for the theme change the cropping option as I suggested.
  • None of the themes that ship with Zenphoto have options to separately set the thumbnail crop width and height.

    My own custom theme doesn't have them, either, as Zenphoto used to let you set width and height separately.

    What would I do if I wanted to add this to a theme's options page?
  • You would have to modify your theme to make & save those options. Really not any different from any other option a theme deals with.
  • Are there any themes out there that actually do this, so I don't have to spend half a day unwinding a significant portion of Zenphoto's source to make it work like it used to a few versions ago?
  • I guess I won't be bringing the site that uses Zenphoto back online until I have time to either stare at ZP's source for a half a day to add back this one little feature, or recreate the theme in another gallery and figure out how to import it. Oh well.
  • acrylian Administrator, Developer
    Why don't you just use the custom image functions? It is really not that difficult. Also see this topic:
  • > Why don't you just use the custom image functions?

    Because if I'm reading the stuff on right, I would hard-code in locations for the thumbnails to be plucked out of. As far as I can tell that's going to do absolutely nothing in terms of talking to the thumbnail cropper so I can choose arbitrary rectangles of my set proportions for the thumbs to be cropped from.
  • If you can compute the rectangle then you can use a custom function to generate the thumbnail complete with cropping. If you have to do this manually....
Sign In or Register to comment.