php help

Discussion in 'Web Design & Coding' started by Moonwraith, Dec 13, 2005.

  1. Moonwraith

    Moonwraith Moderator Folding Team

    Messages:
    1,131
    Location:
    UK
    Hey guys,

    Got a major favour for all you php guys out there, now I've asked before for a dynamic sig, which i still have the php code for.. but i need something maybe a bit more advanced.. see if you guys could help me out on this one..

    I'm after

    "Write relevant HTML web pages and PHP to view a catalogue of images (Gif or JPEG format) stored in an image subdirectory. You should provide a simple means of selecting an imagine file and then, upon selection, the image will be displayed on a web page together with the chance to select another image

    The list of files should be dynamic - your CGI script should be able to provide a list of the current contents of the image directory at any time"

    Now, The current dynamic code i've got is handy; because it will load, dynmically, a random image from the folder on each refresh, but i need to do all of the above, and it's proving tricky - anyone about who knows what their doing would be awesome :)

    Thanks

    -Wraith
     
    Last edited: Dec 13, 2005
  2. Moonwraith

    Moonwraith Moderator Folding Team

    Messages:
    1,131
    Location:
    UK
    bumpage.. no one here got any ideas? :suprised:
     
  3. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    http://picklegallery.sourceforge.net/

    Is an allready written PHP script which is rather easy to understand, see if you can get some ideas from them as to how to do it (Do note, DO NOT COPY AND PASTE, the code is under the GPL, and you would be infringing)
     
  4. Moonwraith

    Moonwraith Moderator Folding Team

    Messages:
    1,131
    Location:
    UK
    many thanks dude :) not gonna copy and paste anyways, my lecturers in the know on plagarism
     
  5. mlakrid

    mlakrid OSNN BASSMASTER Political User Folding Team

    Hey moon I take it your a Starcraft BW fanatic?
     
  6. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    the way I would do it is first open the directory (fopen can do this I believe) then using a loop check each file within the directory to make sure its an image (getimagesize would be good here). You can either output the images at this point or add them to an array for use in outputting the page then.

    you would need some input parameters in order to show a specific image, but if you show the image at the top, then below that show the array of images again.

    That should work, a friend of mine uses that kind of process for his rather simple picture gallery.
     
  7. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA

    How'd you do it for: http://geffy.co.uk/gallery/harcourt_place/?
     
  8. Moonwraith

    Moonwraith Moderator Folding Team

    Messages:
    1,131
    Location:
    UK
    Looks like lots of links by the looks of the source!

    Cheers geffy, i'll see what i can sort tomorrow, my php sucks.. so we'll see what i can knock out
     
  9. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    Mine uses a special feature of apache to work without the need for mod_rewrite, but the actual core processes are the same as I mentioned before, but I do a little more like sorting arrays and so on
     
  10. Moonwraith

    Moonwraith Moderator Folding Team

    Messages:
    1,131
    Location:
    UK
    (And yeah, just to reply; loved starcraft :) thinking about it, probably time to make a new sig soon)