1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Displaying Images in Order

Discussion in 'PHP' started by xtreme fever, Jul 15, 2009.

  1. #1
    How can I display images from a directory in order and not by random?
    SEMrush
     
    xtreme fever, Jul 15, 2009 IP
    SEMrush
  2. jbrooksuk

    jbrooksuk Active Member

    Messages:
    127
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    81
    #2
    Name them appropriately: Img1, Img2, Img3.

    Loop through each file in the directory, by name, and output.
     
    jbrooksuk, Jul 15, 2009 IP
  3. goscript

    goscript Prominent Member

    Messages:
    2,753
    Likes Received:
    306
    Best Answers:
    0
    Trophy Points:
    315
    #3
    Use scandir

    You can sort them as you want.
     
    goscript, Jul 15, 2009 IP
  4. xtreme fever

    xtreme fever Active Member

    Messages:
    472
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #4
    Thanks all
     
    xtreme fever, Jul 15, 2009 IP
  5. xtreme fever

    xtreme fever Active Member

    Messages:
    472
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #5
    I figured out another way to do what I wanted.
     
    xtreme fever, Jul 15, 2009 IP
  6. goscript

    goscript Prominent Member

    Messages:
    2,753
    Likes Received:
    306
    Best Answers:
    0
    Trophy Points:
    315
    #6
    Mind sharing with us? :)
     
    goscript, Jul 15, 2009 IP
  7. xtreme fever

    xtreme fever Active Member

    Messages:
    472
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #7
    It took my brain awhile to wake up and think of it. I needed to display random images with rollovers and since the random image script wouldn't work, I am using a random html/text script to load the images.

    I love when my brain take a few hours or days to wake up :)
     
    xtreme fever, Jul 15, 2009 IP
    goscript likes this.
  8. jbrooksuk

    jbrooksuk Active Member

    Messages:
    127
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    81
    #8
    So they aren't ordered then are they.
     
    jbrooksuk, Jul 15, 2009 IP
  9. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #9
    yup seems you are very conufuzzled !
     
    wd_2k6, Jul 15, 2009 IP