Quite new to this - I'm doing this tutorial:
http://www.sitepoint.com/article/photo-gallery-cakephp-flickr/ and I'm
having issues on index.ctp. This is the troublesome code:
-----------------------------------------------------------------
<img id="mainimg" src="<?php echo $flickr->buildPhotoURL($thumbs
['photo'][0], 'medium')?>" title="<?php echo $thumbs['photo'][0]
['title']?>" alt="<?php echo $thumbs['photo'][0]['title']?>" />
-----------------------------------------------------------------
and this is the output I'm getting from it:
----------------------------------------------------------------
Notice (8): Undefined index: photo [APP\views\gallery\index.ctp, line
12] http://farm.static.flickr.com//_.jpg" title="" alt="" />
----------------------------------------------------------------
buildPhotoURL() looks like this:
----------------------------------------------------------------
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"
);
$size = strtolower($size);
if (!array_key_exists($size, $sizes)) {
$size = "medium";
}
if ($size == "original") {
$url = "http://farm" . $photo['farm'] . ".static.flickr.com/" .
$photo['server'] . "/" . $photo['id'] . "_" . $photo
['originalsecret'] . "_o" . "." . $photo['originalformat'];
} else {
$url = "http://farm" . $photo['farm'] . ".static.flickr.com/" .
$photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . $sizes
[$size] . ".jpg";
}
return $url;
}
----------------------------------------------------------------
I know the tutorial is quite out-of-date now, so something might have
changed in either API that I don't know about it, or I could just be
doing something wrong. Does anybody have any ideas, am I missing
something obvious?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment