•  » Requests
  •  » Galleries sort by amount of photos inside

#1 2012-07-14 21:05:53

dennisyan
Translation Team
2012-07-14
17

Galleries sort by amount of photos inside

Hi there. Although I'm new here, I've been a loyal fan of Piwigo for a long time.

I'm now working on a botanical gallery with Piwigo. I arrange my plant photo collections by the biological "families" they belong to, which means there're many categories (now I've built more than 100 cat.s). The problem you can imagine is that, a long page with many sub-cats, some cats of big plant "families" have many photos inside, while some small families get only 1 or 2 photos inside.

Under that condition, sorting by cat names is not a nice way to present the gallery, I think to show the categories with more photos inside on top of the page would be a better choice. Of course one can do that manually, but considering the big amount of categories and the changing amount of photos inside, always manually change the order will be a miserable work.

So I guess the way of solving this problem is, to make galleries possible to be sorted by amount of photos in side, or more simple: in a same level, show bigger galleries on the top, and of course, with the condition that when galleries have same amount of photos inside, show them alphanumerically.

Maybe not everyone need it, but I think it's an important user-friendly function for many people.
Thank you Piwigo team!

(BTW, it'll be very grateful if there's some easy way to realize that function by editing source codes, thanks!)

Last edited by dennisyan (2012-07-14 21:23:55)

Offline

 

#2 2013-01-22 19:50:45

dennisyan
Translation Team
2012-07-14
17

Re: Galleries sort by amount of photos inside

up! (6 months no reply, but I still think it's important not only for me, and after all, it's not so difficult to realize. Piwigo people, pls. take this into account, thanks! )

Offline

 

#3 2013-01-22 19:59:31

flop25
Piwigo Team
2006-07-06
7037

Re: Galleries sort by amount of photos inside

I don't know how to do it, that's why I didn't answer
Maybe someone could


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

 

#4 2013-01-22 21:51:08

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Galleries sort by amount of photos inside

I would say based on the latest version, it should be easy to modify include/category_cats.inc.php by replacing

Code:

if ('recent_cats' != $page['section'])
{
  $query.= '
  ORDER BY rank';
}

with

Code:

if ('recent_cats' != $page['section'])
{
  $query.= '
  ORDER BY nb_images DESC';
}

Offline

 

#5 2013-01-22 21:52:31

dennisyan
Translation Team
2012-07-14
17

Re: Galleries sort by amount of photos inside

flop25 wrote:

I don't know how to do it, that's why I didn't answer
Maybe someone could

Hi flop25, thank you for your answer.

I'm not a programmer (only know some html and css), but I can't understand why this function is difficult.
The main program already counts the numbers of photos in every category (and they're shown in the frontstage). What needs to do is just make the father-category list page to list sub-categories by those numbers.

I know not so many users have an album contains 100+ categories, but some users like me use piwigo as natural history album, and need to build a big classification for different filming objects. You can imagine this: one day I go out and record 70 images of plants and animals, now I put 70 photos of different objects into 20 categories (no new photo for the other 80 categories), and then number of photos in every category (of this 20) changes, or we can say "size" of these 20 categories changes. How long and how many clicks-drags will it takes if I re-order the category list (of course not only 20 but 100) by its "size" manually? But with a program, re-order by "size" can be done in less then 0.1sec. That's why we need computer!

Offline

 

#6 2013-01-22 22:14:25

dennisyan
Translation Team
2012-07-14
17

Re: Galleries sort by amount of photos inside

rvelices wrote:

I would say based on the latest version, it should be easy to modify include/category_cats.inc.php by replacing

Code:

if ('recent_cats' != $page['section'])
{
  $query.= '
  ORDER BY rank';
}

with

Code:

if ('recent_cats' != $page['section'])
{
  $query.= '
  ORDER BY nb_images DESC';
}

Hi rvelices, thank you so much for your answer.
Does "ORDER BY nb_images DESC" works? maybe I'll give it a try, thank you!

However if this works, this only works on recent_cats page, but not on main page menu or category pages. I hope this function can be considered and written into admin.lang.php, as a new auto-sorting option, and user can customize the ways of auto-sorting in every different category / sub-category.

Offline

 
  •  » Requests
  •  » Galleries sort by amount of photos inside

Board footer

Powered by FluxBB

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