Support » Themes and Templates » Random Image

  • The Jakarta script displays an image at the bottom of each post, using this code:
    <center><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/hr.gif” alt=”The End”/></center>

    Does anyone know of any way to display one of n images (hr1.gif, hr2.gif, hr3.gif, etc)

    What that would require was taking some index number and doing a “modulo” function, for example if I had three different images hrmodulo(index,3).gif would get it, but I dont know enough about php to know how to code that. Can anyone help me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Look for a plugin in http://codex.wordpress.org/plugins.
    There are some random image display plugins.

    All I saw was PhotoPress http://isaac.wedin.org/photopress/ which did a LOT more than what I wanted, and seemed to only provide one random graphic inserter

    I need something that I can use more than once in a template (use one gets images 1a, 1b, 1c and use two gets 2a, 2b, and 2c)

    I am pretty sure the modulo approach I suggested would work, if someone can tell me of a tag that is numeric, and how to use php to form the name of an image that will then be displayed

    I have used a plugin called multiple-random-img to do what you want. I have also use a plugin call flashfader.

    flashfader seems to load a flash slideshow, and multiple-random-img seems like overkill, because it is designed for pulling n images from a m (n<m) database

    I really need to find a numeric tag I can do a modulo on, and let it generate a number to append to a file name, as described above.

    I came up with my own solution:

    <img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/rule<?=rand(1,5)?>.gif”>

    randomly selects rule1.gif, rule2.gif,… rule5.gif

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Random Image’ is closed to new replies.