Monday, June 29, 2009

Re: Sitepoint tutorial with Flickr component

Hi Vijay - thanks for your help!

The photo array is blank while all the other key pairs are populated,
and photo is the only keypair that uses an array:
---------------------------------------------------------------------------
$thumbs = array(
"photoset" => array(
"id" => "72157620559969985",
"primary" => "65816580",
"owner" => "23548413@N00",
"ownername" => "algo",
"photo" => array(),
"page" => 1,
"per_page" => 500,
"perpage" => 500,
"pages" => 1,
"total" => "1"
),
----------------------------------------------------------------------------

Photo is the only key pair that has an array - so I guess that's
significant. If I change $this->set('thumbs',$this->flickr-
>photosets_getPhotos($currset)); in GalleryController to $this->set
('thumbs',$this->flickr->photosets_getPhotos(array($currset))); then
that switches $thumbs to false, so it looks like my syntax is off,
also!

Is there a special way to push the array through?

Thanks again!
Hols

On Jun 29, 2:22 pm, Vijay Kumbhar <k.vidn...@gmail.com> wrote:
> Hey Hols,
>
> Can you please checked  printing that $photo array??
> Please check that one. If that array is blank / or please check the
> structure of that array then it gives the error.
>
>
>
> On Mon, Jun 29, 2009 at 6:22 PM, Hols Kay <hol...@googlemail.com> wrote:
>
> > Hi guys,
>
> > 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!
>
> --
> Thanks & Regards,
> Vijayk.
> Co-founder (www.weboniselab.com)
>
> "You Bring the Dreams, We'll Bring the Means"
--~--~---------~--~----~------------~-------~--~----~
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: