Random image from (sub)albums - combining album.php and image.php

I'd like to have an image shown on every page (not just image.php)...

On index.php I'd like to have a random image shown (above thumbnails for albums) selected at random from ALL albums...

On album.php I'd like to have a random image shown (above thumbnails for albums) selected at random from all SUB-albums...

How do I achieve this?

(Also, on image.php I'd like to have a fixed number of thumbnails shown below the main image, but that's another issue...)

( work-in-progress: http://mkiv.kjtooke.dyndns.org/ )

Comments

  • The efferevescence+ theme does this. You can review how it accomplishes it.
  • OK, got that sorted using the relevant part of the customfunctions.php script from effervescence+

    Is there anyway of incorporating the following into this script:

    if (getFullWidth() === getFullHeight() OR getFullWidth() > getFullHeight()) {
    printCustomSizedImage(getImageTitle(), null, 600, null, null, null, null, null, 'reflect');
    }
    else {
    printCustomSizedImage(getImageTitle(), null, null , 400, null, null, null, null, 'reflect');
    }
  • Hmmm... It seems to be picking a random image from the entire gallery.

    This is fine for index.php, but for album.php I want it limited to the current album and/or any subalbums.

    Is there a setting or fix for this?
  • Effervescence+ uses two different functions for random images. In index.php page it uses `printHeadingImage(getRandomImages());` which draws an image at random from the gallery. In album.php it uses `printHeadingImage(getRandomImagesAlbum());` which draws the image from the album or its subalbums.

    As for adding the code above, just put it in your version of the script.
  • already had it coded that way...

    this only happens when I'm logged in - when logged out it works as expected.
  • how do I get getFullWidth() and getFullHeight() on this random pic?

    as I'm not on the relevent url for whatever random pic is selected, is there a way of manually passing the random pic url to these functions?

    I need a way of setting the size of the image so it fits inside a 600px wide by 400px tall canvas without cropping

    $size is limited to width (whereas I need height)
  • `$randomimage->getHeight()` and `$randomimage->getWidth()`
  • Thanks...
  • My new theme is almost complete...

    Just one last thing I'd like to try to incorporate with regards to random images:

    How do I get a random images from (limited to) the search results? I'd like to display this above the thumbs on the search results page (so that it matches the rest of the theme pages).
Sign In or Register to comment.