Announcement

#1 2020-01-10 22:27:36

TheDoc
Member
Munich / Germany
2015-10-18
173

"_" in directory names

Hi,

maybe that has been asked before but I didn't have any luck searching for "_" - way to many mathces...

I have directories under .\galleries that have "_" in their name, e.g. "Christmas_2019". For those the category name is then "Christmas 2019" with SPACE instead of "_". Any way to change that behavior?

Thanks!
Thomas

    Piwigo 2.10.1 Check for upgrade
    Operating system: Linux
    PHP: 7.3.13 (Show info) [2020-01-10 22:27:09]
    MySQL: 5.5.60-0+deb7u1-log [2020-01-10 22:27:09]
    Graphics Library: External ImageMagick 6.8.9-9

Offline

 

#2 2020-01-11 03:32:39

erAck
Only trying to help
2015-09-06
2029

Re: "_" in directory names

There are 3 places (except one unrelated in ./themes/modus/admin/admin.inc.php) found for a

Code:

grep -r "str_replace( *'_' *, *' '" .

./admin/element_set_ranks.php:                  $thumbnail_name = str_replace('_', ' ', $file_wo_ext);
./admin/site_update.php:        'name'        => str_replace('_', ' ', $dir),
./include/functions.inc.php:  return str_replace('_',' ',get_filename_wo_extension($filename));

of which the one in ./admin/site_update.php where the directories are looped seems to be related. However, I don't know what exactly would happen if that was changed.. probably only new directories would be treated, worst case you might end up with duplicated category names with and without underscore (though it doesn't look like, but I didn't investigate deeper).

Btw, I think having spaces instead of underscores for display purposes is nice. Category URIs are generated with underscore again.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2020-01-11 16:40:58

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: "_" in directory names

Thanks for the quick answer. Better not touch those places in the code :-)

I usually rename my categories after sync anyways to nicer names. So I can live with the replacement since its overwritten anyways. I only need to keep that in mind for the required SQL...

Offline

 

Board footer

Powered by FluxBB

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