Adam Bate
Members
-
Joined
-
Last visited
Reputation Activity
-
Adam Bate got a reaction from Pezza4u in Photo gallery client can add to?Hey Pezza4u,
Yeah, my install was a little out dated. I had some time this morning to take a closer look on a fresh install. I have added a list of available sizes to the tutorial - thanks for the tip.
I have also put up a solution for displaying the description. Here is the code you'll need:
<div id="gallery">
<?php foreach ($ph_sets['photoset'] 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['photoset']['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>
<?php endforeach; ?>
</div>
The changes include the addition of the line, "$d = $f->photos_getInfo($photo['id']);" as well as changing the title attribute in the <a> tag to $d['photo']['description'].
As I mentioned on the tutorial, it's a little inefficient due to having to lookup the description for every photo (needs to be done in the loop) so it might slow down load time of your site. Unfortunately there does not seem to be a way to grab this info for the entire photoset outside of the loop. Once they implement this (or I figure out that there is a way) I'll make the necessary changes.
Hope this helps!
-
Adam Bate got a reaction from Pezza4u in Photo gallery client can add to?Just figured out the medium size issue. I didn't realize there were 2 "medium" sizes according to flickr, a 500 and a 640.
I noticed the 640 as you said is the one with _z on the end.
This is what you'll need to do:
Edit the phpFlickr.php file and find the following lines:
function buildPhotoURL ($photo, $size = "Medium")
{
//receives an array (can use the individual photo data returned
//from an API call) and returns a URL (doesn't mean that the
//file size exists)
$sizes = array(
"square" => "_s",
"thumbnail" => "_t",
"small" => "_m",
"medium" => "",
"large" => "_b",
"original" => "_o"
);
You have two options. If you want all 'medium' results to be the 640 instead of the 500, simply change this line:
"medium" => "",
to:
"medium" => "_z",
Alternatively, you can try to add another line altogether, such as this:
"med640" => "_z",
Not sure the the latter will work as I didn't check the rest of the file, but I'm assuming it will.
I didn't test this on a gallery, but I'm 99% sure it'll work.
Cheers.
Adam.