Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

$serialize_dir_data reverses picture order
https://www.tinywebgallery.com/forum/viewtopic.php?f=5&t=3711
Page 1 of 1

Author:  TroubledUser [ 31. Jul 2014, 13:45 ]
Post subject:  $serialize_dir_data reverses picture order

Activating $serialize_dir_data *sometimes* reverses the order of my photos.

I'm using TWG 2.1 and sorting my pictures by file name.

Globally, I have set $sort_images_ascending = false;, so I can add new ones by simply increasing a counter.
Locally (in two of the config.php files residing in the pictures folders) I reversed the order by setting $sort_images_ascending=true; - these are complete albums which are are simply uploaded the way they were taken.

Now, enabling $serialize_dir_data *sometimes* reverses the order. Performing any operation in the gallery folder (touching a file) fixes the issue temporarily, as the cache is re-generated then (I guess).

I deactivated the serialization for now, as the changing order really bugs me. I guess when the cache is generated, it does not obey the local config.php? Second guess, it *does* obey it, but the gallery-viewing code does not care whether the information was obtained directly from the file system (sorted ascending) or from cache, so the order gets reversed twice if cached.

Does that include all necessary information? :)

Thanks in advance.

Author:  TinyWebGallery [ 31. Jul 2014, 18:30 ]
Post subject:  Re: $serialize_dir_data reverses picture order

Please see http://www.tinywebgallery.com/en/faq.php -> howto 6. How to set a gallery name different from the folder name (e.g. for enhanced sorting)
---
Since 1.7.4 you can use a file called config_sort.php. This makes it possible to sort a sub directory different then the rest. You only can place the following parameters to this file: $sort_images_ascending, $sort_by_date, $sort_by_filedate, $sort_albums, $sort_albums_ascending, $sort_album_by_date. This file works for image sorting as well. Don't use a custom folder config.php for sorting because settings in there would overwrite settings global during caching. If you use private galleries you have create a config_sort.php in the pictures folder as well. There you store the sorting of the main folder!
---
Otherwise it always depends which cache is already build. So if a folder before had a custom config.php it does overwrite the global settings while another one does not.

Best, Michael

Author:  TroubledUser [ 31. Jul 2014, 23:29 ]
Post subject:  Re: $serialize_dir_data reverses picture order

Ouh, so no bug then. But good to see that the code behaves exactly as I thought :)

Thanks!

Author:  TinyWebGallery [ 1. Aug 2014, 08:50 ]
Post subject:  Re: $serialize_dir_data reverses picture order

;).

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/