New Man New Man - 2 months ago 14
PHP Question

Echo php image gallery

I used http://nanogallery2.nanostudio.org/index.html to parse gallery, but not working. I need help!

My code:

<div data-nanogallery2='{
"itemsBaseURL": "http://nanogallery2.nanostudio.org/samples/",
"thumbnailWidth": "auto",
"thumbnailHeight": "auto",
"thumbnailDisplayInterval": 30,
"thumbnailLabel": {
"display": false
},
"displayBreadcrumb": false,
"breadcrumbAutoHideTopLevel": false,
"breadcrumbOnlyCurrentLevel": false,
"thumbnailOpenImage": false
}'>

<?php foreach($arr_img as $img) { ?>
<a href="#" data-ngthumb="<?php echo $img; ?>"></a>
<?php } ?>

</div>


It show, but all echo
$img
are in 1 line like this:

enter image description here

Help me, how to fix, thanks!

Answer Source

The framework you chosed works for self hosted images. You try to work with external flickr links, the syntax here ii a liitle bit different e.g.

<div data-nanogallery2='{
        "userID": "149035168@N08", //User-Id
        "kind": "flickr", //Content type, google images is also supported
        "photoset": "72157675715292251", //The set of photos you want
        "thumbnailWidth": "200",
        "thumbnailDisplayInterval": 30
      }'>

The best will be if you read the official documentation to implement your pictures: http://nanogallery2.nanostudio.org/datasource.html#ngy2_flickr

If you want just specific images you can do this by working with the whiteList attribute.