Search code examples
jquerycolorboxfeedflickr

ColorBox with Flickr Feed


I have implemented the following http://www.jacklmoore.com/notes/colorbox-with-json-or-flickr on my website and everything is working correctly. I can images can click on them and they are getting pulled from Flickr. All that works perfectly EXCEPT I can only see first 6 images???

I tried going over the whole code but can't find why it ONLY LOADS FIRST 6 IMAGES???!!! I can see all my images using a browser but not on my website.

I thought it might be a cashing problem or something but then I did delete one of the images and right away it showed me 5 images and 1 it says there is a problem loading this image.

Can someone help me figure it out?

    <script>

        var params = {
            id: 'Insert Your Flickr ID here', // my Flickr User ID
            format: 'json',
            jsoncallback: '?'
        },
        feedURL = 'http://api.flickr.com/services/feeds/photos_public.gne',
        feedQuery = decodeURIComponent($.param(params));

        function buildLinks(json) {
            var photo,
            $links = $(), 
            $thumb,
            $anchor;

            while ( photo = json.items.pop() ){
                $anchor = $('<a/>').attr({
                    // get the medium-large size photo
                    href: photo.media.m.replace('_m', '_z'),
                    title: photo.title
                });

                $thumb = $('<img/>').attr({
                    // get the small-square size thumbnail photo
                    src: photo.media.m.replace('_m', '_s'),
                    alt: photo.title
                }).appendTo($anchor);

                $links = $links.add($anchor);
            }

            $links.colorbox({rel:'flickr'});

            // Wait until the DOM has loaded before trying to append to the body
            $(document).ready(function () {
                $('#content').append($links);
            });
        }

        $.getJSON(feedURL + '?' + feedQuery, buildLinks);

    </script>

Solution

  • If it is only showing 6 images, then maybe that is all the Flickr Feed returned. Have you checked to see what the feed is giving you?