Results 1 to 4 of 4

Thread: trouble creating a photo gallery

  1. #1
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Post trouble creating a photo gallery

    so, I'm trying to learn how to write enough PHP in order to create a photo gallery,

    I can't imagine that it would be too tough, all my jpegs are in one location. I just need to be able to scroll through them online is all. I'm not all sure where to start with this.

    Ideally I'd love to see a basic premade script that I could use and have it explained to me so I can recreate it later.

    Any and All help is appreciated.

  2. #2
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,588
    Thanks
    57
    Thanked 99 Times in 97 Posts
    Blog Entries
    4

    Default

    Photo gallery's are normally programmed in Javascript...

    If you want to use php to make a photo gallery, you'd have to put up with the page loading inbetween photos...

    Is php really what you want?
    Posting Tips + FAQ | Issues? Feel free to PM me
    - keyboard1333[at]gmail[dot]com

  3. The Following User Says Thank You to keyboard For This Useful Post:

    Reptar92 (08-09-2012)

  4. #3
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I don't care about the loading screen. it doesn't need to be too shiny. since my knowledge is about nil on both PHP and Java, which is the easiest way to accomplish a simply way to view photos from my browser

  5. #4
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,588
    Thanks
    57
    Thanked 99 Times in 97 Posts
    Blog Entries
    4

    Default

    Php is probably the easiest..... probably

    This works...

    PHP Code:
    <?php
    $imagearray
    [0] = 'src="FIRST IMG URL HERE" alt="FIRST IMG ALT HERE"';
    $imagearray[1] = 'src="SECOND IMG URL HERE" alt="SECOND IMG ALT HERE"';
    $imagearray[2] = 'src="THIRD IMG URL HERE" alt="THIRD IMG ALT HERE"';
    $imagearray[3] = 'src="FOURTH IMG URL HERE" alt="FOURTH IMG ALT HERE"';
    //Shouldn't need to edit past here
    if(isset($_GET['img'])) {
    $getval $_GET['img'];
    } else {
    $getval 0;
    }
    if(!
    is_numeric($getval)) {
    die(
    '<!DOCTYPE html><html><head></head><body>Invalid picture</body></html>');
    }
    if(!isset(
    $imagearray[$getval])) {
    die(
    '<!DOCTYPE html><html><head></head><body>Invalid picture</body></html>');
    }
    $previous $getval 1;
    $next $getval 1;
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <img <?php echo $imagearray[$getval]; ?> >
    <br />
    <?php
    if($getval == 0) {
    echo 
    '<a href=""><input type="button" disabled="true" value="Previous"></a>';
    } else {
    echo 
    '<a href="?img=' $previous '"><input type="button" value="Previous"></a>';
    }
    if(
    $getval == count($imagearray) - 1) {
    echo 
    '<a href=""><input type="button" disabled="true" value="Next"></a>';
    } else {
    echo 
    '<a href="?img=' $next '"><input type="button" value="Next"></a>';
    }
    ?>
    </body>
    </html>
    Tell me if you want me to explain anything...
    Last edited by keyboard; 08-09-2012 at 04:16 AM.
    Posting Tips + FAQ | Issues? Feel free to PM me
    - keyboard1333[at]gmail[dot]com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •