mikahanninen / grav-plugin-facebook

Facebook plugin for Grav CMS https://github.com/getgrav/grav
MIT License
16 stars 12 forks source link

Gallery just imports 25 pictures #44

Open prinla opened 6 years ago

prinla commented 6 years ago

Whatever gallery I choose from my Facebook page, the plugin only parses 25 pictures... Any solution/explanation? Thanks Oliver

loopion commented 6 years ago

I’ve took a look recently because I had je same problem. This is because by default Facebook return only 25 elements. If you want to return more, the a pagination in je JSON response must be develop and it’s currently not the case.

prinla commented 6 years ago

Thanks... For the moment I found a turn-around by add . '&limit=100' to line 304 of the facebook.php

. $config->get('facebook_common_settings.application_secret') . '&limit=100';

Now it shows 99 pictures. Changing the limit to over 100 doesn't change anything!

Is somebody here that is able to adjust the facebook.php so all pictures could be rendered?

prinla commented 6 years ago

Also it would be great having this pagination to show only a defined number of pictures on the first sight and put a show-more-button that allows to show the rest of the pictures.

For the moment I found a turn-around by adding this to my partial-gallery-template:

{% set firstTen = album.photos|slice(0, 10) %}
{% set showmore = album.photos|slice(10, 100) %}

<div id='facebook-gallery'>
<div id='facebook-gallery-photos'>
{% for photo in firstTen %}
<div class="fbpictures"><a href="{{ photo.source|raw }}" class="mygallery"><img src="{{ photo.source|raw }}"/></a></div>
{% endfor %}
<div id="q1" style="display:none">
{% for photo in showmore %}
<div class="fbpictures"><a href="{{ photo.source|raw }}" class="mygallery"><img src="{{ photo.source|raw }}"/></a></div>
{% endfor %}
</div>
<button class="morepictures" onclick="myFunction()">More Pictures</button>
</div>
</div> 

An then adjusting the show-more button by javascript on click to change the display:none to display:block