Announcement

#1 2011-02-20 16:27:17

willy
Member
2011-02-20
2

[resolved] numeric filesort

My problem: Pictures from a web camera is fed into my server- they all start
with "camera" and are numbered 1-2048. I want them to be displayed 1 - 2 ..
2048 .. and to to that, I need a numeric sort (-n). Alfanumeric sort gives 1
- 10 - 1000 -1001 ,,,
Please help ..

Offline

 

#2 2011-02-20 16:57:49

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: [resolved] numeric filesort

Edit your local config file (with LocalFiles Editor plugin) and insert:

$conf['order_by'] = ' ORDER BY LENGTH(file), file ASC';
$conf['order_by_inside_category'] = $conf['order_by'];


P@t

Offline

 

#3 2011-02-20 19:48:13

willy
Member
2011-02-20
2

Re: [resolved] numeric filesort

Thanks!! Works like a dream :)

Offline

 

#4 2011-02-20 22:12:25

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13548

Re: [resolved] numeric filesort

P@t wrote:

ORDER BY LENGTH(file), file ASC

Very smart!

Offline

 

#5 2014-10-29 12:05:39

NewbieX
Member
2012-11-10
11

Re: [resolved] numeric filesort

Is this correct for more latest piwigo, such as 2.7.1 ?

$conf['order_by_custom'] = ' ORDER BY LENGTH(file), file ASC';
$conf['order_by_inside_category'] = $conf['order_by'];

Offline

 

Board footer

Powered by FluxBB

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