Announcement

#1 2017-10-27 19:17:52

hkk007
Member
2017-10-27
3

Is there any way to get recent photos from a piwigo gallery

Hello/Hi/Greetings,

I am developing a website in which i have installed piwigo and it is working fine. Huge thanks for developers.
I have used Piwigo-random library (https://github.com/moy/piwigo-random) from git hub to show some random images from my gallery in my home page.
But now i want to show recent images in home page. how can i do that ?

please help me by providing some solution.

Piwigo version: latest
PHP version: latest
MySQL version: latest
Piwigo URL: http://

Offline

 

#2 2017-10-27 20:03:00

eliz82
Member
Romania
2016-04-27
281

Re: Is there any way to get recent photos from a piwigo gallery

hkk007 wrote:

But now i want to show recent images in home page. how can i do that ?

Home page of who ... Piwigo?
If yes you can do that with PWG stuff plugin http://piwigo.org/ext/extension_view.php?eid=190

or method 2 ... you can go in you theme templates and edit them, use that library that you are using now because smarty templates allow you to write html and php inside them.

Offline

 

#3 2017-10-27 22:22:06

teekay
Member
2013-06-12
427

Re: Is there any way to get recent photos from a piwigo gallery

I guess it's a separate website.

Just use that piwigo-random plugin and edit [Github] piwigo-random file piwigo-random-backend.php@L96
replace "&order=random" with "&order=date_available%20desc"

Last edited by teekay (2017-10-27 22:33:06)

Offline

 

#4 2017-10-28 00:38:21

flop25
Piwigo Team
2006-07-06
7037

Re: Is there any way to get recent photos from a piwigo gallery

please give more details

the eliz82 solution can be completed by using the /index.php?/recent_pics page in the local config for parameter which allows you to set another index/home page


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2017-10-28 04:51:15

hkk007
Member
2017-10-27
3

Re: Is there any way to get recent photos from a piwigo gallery

Sorry for the late reply.
i want to show the recent images in the home page of my website.not gallery home page.
i will try your answer, editing piwigo-random-backend.php and replyyou soon. thanks for the support.

Offline

 

#6 2017-10-28 08:32:14

hkk007
Member
2017-10-27
3

Re: Is there any way to get recent photos from a piwigo gallery

teekay wrote:

I guess it's a separate website.

Just use that piwigo-random plugin and edit [Github] piwigo-random file piwigo-random-backend.php@L96
replace "&order=random" with "&order=date_available%20desc"

i have changed as you said piwigo-random-backend.php#L96
but after that images show in some other order. not recent posted order

can you tell me how api is called to show recent images.

this is the gallery

http://malikdeenargreatjumamasjid.com/newgallery/

i want to show recent photos in this page(visit on phone)

http://malikdeenargreatjumamasjid.com/m/index.php

but it shows some other order

Offline

 

#7 2017-10-28 09:30:59

teekay
Member
2013-06-12
427

Re: Is there any way to get recent photos from a piwigo gallery

Hi,

the order looks correct, but it seems to start with an offset.

Look at http://malikdeenargreatjumamasjid.com/n … ories/flat - sort order date created new -> old, the second row is what gets displayed (pic ids 53, 52, 51, 50 in that order)

Does that piwigo-random-backend.php thing fire on every request, or is it caching things somehow? If you call the API directly, it pics the latest images.
http://malikdeenargreatjumamasjid.com/n … ble%20desc


If you know some jQuery, you could also use something like this instead of piwigo-random:

Code:

<div id="recent-images"></div>

<script type="text/javascript">
var pwg_api = "http://malikdeenargreatjumamasjid.com/newgallery/ws.php?format=json&method=pwg.categories.getImages&recursive=true&per_page=5&recursive=true&order=date_available%20desc";

$.getJSON(pwg_api, function (json) {
    var images = json.result.images;

    $.each( images, function ( i, image ) {
       var src = image.derivatives.xlarge.url;
       var height = image.derivatives.xlarge.height;
       var name = image.file;
       var link = image.categories[0].page_url;

       $('#recent-images').append('<img class="img-fluid" src="' + src + '" alt="' + name + '"/>');
    });
});
</script>

Last edited by teekay (2017-10-28 09:51:29)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact