Results 1 to 3 of 3

Thread: Images for PHP Flickr Gallery Not Showing up in WAMP

  1. #1
    Join Date
    Aug 2011
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Images for PHP Flickr Gallery Not Showing up in WAMP

    Hello. I have created a photo gallery that uses php to pull images from flickr. The gallery displays perfectly when live online, but the photos do not dipslay in WAMP, only small placeholders (see attached screen shot). I'm not sure if this has to do with the php coding or the WAMP settings. I would assume the latter, since it works when online, but I wanted to get your take on it. I would appreciate any help or suggestions. The code from the html page is below:

    HTML Code:
    <?php 
    
    // For paging the thumbnails, get the page we are on
    // if there isn't one - we are on page 1
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    
    //include the core file
    require_once('phpFlickr.php');
    
    // include the config file
    require_once('config.php');
    
    // Fire up the phpFlickr class
    $f = new phpFlickr($key);
    
    // phpFlickr needs a cache folder
    // in this case we have a writable folder on the root of our site, with permissions set to 777
    $f->enableCache("fs", "cache");
    
    //returns an array
    $result = $f->people_findByUsername($username);
    
    // grab our unique user id from the $result array
    $nsid = $result["id"];
    
    // Get the user's public photos and show 21 per page
    //$page at the end specifies which page to start on, that's the page number ($page) that we got at the start
    $photos = $f->people_getPublicPhotos($nsid, NULL, NULL, 21, $page);
    
    // Some bits for paging
    $pages = $photos['photos']['pages']; // returns total number of pages
    $total = $photos['photos']['total']; // returns how many photos there are in total
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>phpFlickr Gallery Demo</title>
    <link href="styles.css" rel="stylesheet" type="text/css">
    <link href="gallery.css" rel="stylesheet" type="text/css">
    
    
        <!-- Lightbox Code-->
    <script type="text/javascript" src="lightbox2.05/js/prototype.js"></script>
    <script type="text/javascript"
              src="lightbox2.05/js/scriptaculous.js?load=effects,builder"></script>
    <script type="text/javascript" src="lightbox2.05/js/lightbox.js"></script>
    
    <link rel="stylesheet" href="lightbox2.05/css/lightbox.css"
         type="text/css" media="screen" />
    <!-- End Lightbox Code -->
    
    
    
    </head>
    
    <body>
    <div id="header">
    <h1><a href="/">phpFlickr Gallery Demo</a></h1>
    </div>
    
    <!-- Photo Gallery -->
    <div id="thumbs">
    
    
    				  <div class="photosets">
    				  <?php foreach ($photos['photos']['photo'] as $photo):
    				  $d = $f->photos_getInfo($photo['id']); ?>
    				  <div class="photos">
    				   <a rel="lightbox[]"
    				     href="<?= $f->buildPhotoURL($photo, 'medium') ?>"
    				     title="<?= $d['photo']['description'] ?>">
    				   <img src="<?= $f->buildPhotoURL($photo, 'square') ?>"
    				     alt="<?= $photo['title'] ?>" title="<?= $photo['title'] ?>" />
    				   </a>
    				  </div>
    				  <?php endforeach; ?>
    				  </div>
    
    
    
    <!-- end thumbs -->
    
    <!-- Paging -->
    <p id="nav">
    <?php
    // Some simple paging code to add Prev/Next to scroll through the thumbnails
    $back = $page - 1; 
    $next = $page + 1; 
    
    if($page > 1) { 
    echo "<a href='?page=$back'>&laquo; <strong>Prev</strong></a>"; 
    } 
    // if not last page
    if($page != $pages) { 
    echo "<a href='?page=$next'><strong>Next</strong> &raquo;</a>";} 
    ?>
    </p>
    
    <?php
    // a quick bit of info about where we are in the gallery
    echo"<p>Page $page of $pages</p>";
    echo"<p class=\"note\">$total photos in the gallery</p>";
    
    ?>
    <!-- End Paging -->
    
    
    <div id="footer">
    
    </div>
    
    </body>
    </html>

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    I have not personally used a localhost server so I could be wrong on this but typically when there is a image display issue it's cause the path to the file is wrong. Now in your case this could be the issue unless you did a straight upload to the online host so the paths are exactly the same. Or you may have folder permissions set wrong on your localhost. Easiest way to see if it's a path issue it to run the file in localhost then do a view page source and try clicking the image src and see what it tells you for the error, like 404 not found or whatever.

  3. #3
    Join Date
    Aug 2011
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply fastsol1.

    I tried going straight to the link for the image in the page source, but nothing showed up. I understand the suggestion; however I'm not sure that it is relevant in this situation. I could be wrong, but since the files are not located on the host (because the src is a php line pulling the photo form flickr), I think it is a different issue. The code is the same for the live and localhost versions of the page, but the local one still will not display.

    Here is the image source for one photo:

    HTML Code:
    <img src="<?= $f->buildPhotoURL($photo, 'square') ?>" alt="<?= $photo['title'] ?>" title="<?= $photo['title'] ?>" />

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
  •