Jump to content

How to Embed a Photo Gallery from Picasa / Flickr / etc.


biggupp

Recommended Posts

http://ahy4life.com/test2/press.php

 

I am following the tutorial below:

 

http://www.adambate.com/how-to-add-a-flickr-based-photo-gallery-to-your-website-phpflickr-lightbox/

 

 

I am encountering errors when I introduce the code below.  Not sure what is causing it. The flickr photo set is named 'AHY' .

 

 

 

php and js

 

<CODE>

 

<script type="text/javascript" src="photos/lightbox2.05/js/prototype.js"></script>

 

<script type="text/javascript"

 

          src="photos/lightbox2.05/js/scriptaculous.js?load=effects,builder"></ script>

 

<script type="text/javascript" src="photos/lightbox2.05/js/lightbox.js"></script>

 

 

 

<?php

 

require_once("photos/phpFlickr-3.1/phpFlickr.php");

 

$f = new phpFlickr("b16911dd0ec59f16ed66e80711edbdaf"); // API

 

$user = "ahy4l@yahoo.com";

 

$ph_sets = $f->photosets_getList($user);

 

?>

 

</CODE>

 

 

 

<CODE>

 

<!-- Photo Gallery -->

 

<div id="gallery">

 

<?php foreach ($ph_sets['AHY'] as $ph_set): ?>

 

  <div class="photosets">

 

  <p><h2><?php print $ph_set['title']; ?></h2></p>

 

  <?php $photoset_id = $ph_set['id'];

 

  $photos = $f->photosets_getPhotos($photoset_id);

 

  foreach ($photos['AHY']['photo'] as $photo): ?>

 

  <div class="photos">

 

  <a rel="lightbox[]"

 

    href="<?= $f->buildPhotoURL($photo, 'medium') ?>"

 

    title="<?= $photo['title'] ?>">

 

  <img src="<?= $f->buildPhotoURL($photo, 'square') ?>"

 

    alt="<?= $photo['title'] ?>" title="<?= $photo['title'] ?>" />

 

  </a>

 

  </div>

 

  <?php endforeach; ?>

 

  </div>

 

<?php endforeach; ?>

 

</div>

 

 

 

The CSS I use for this is:

 

 

 

#gallery {

 

    position: relative;

 

    float: left;

 

    width: 600px;

 

    padding: 0px 15px 10px 15px;

 

}

 

 

 

.photos {

 

    position: relative;

 

    float: left;

 

    display: block;

 

    padding-bottom: 10px;

 

}

 

.photosets {

 

    clear: both;

 

    padding-top: 1px;

 

}

 

.photosets h2 {

 

    color: #000;

 

}

 

</CODE>

Link to comment
Share on other sites

This is the error:

 

Warning: Invalid argument supplied for foreach() in /home1/ahyfouli/public_html/test2/press.php on line 359

The CSS I use for this is: #gallery { position: relative; float: left; width: 600px; padding: 0px 15px 10px 15px; } .photos { position: relative; float: left; display: block; padding-bottom: 10px; } .photosets { clear: both; padding-top: 1px; } .photosets h2 { color: #000; }

Link to comment
Share on other sites

  • 1 month later...

The issue is with the following line:

 

<?php foreach ($ph_sets['AHY'] as $ph_set): ?>

 

It should be:

 

<?php foreach ($ph_sets['photoset'] as $ph_set): ?>

 

The 'photoset' in this particular case is part of the API and not to be replaced with your photoset ID.

 

I hope this helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.