Russian folders and files on windows

Hello, i try to make from Zenphoto web gallery. I have large archive of photos with structure maked while ages..Aim is - leave structure as is(ie russian names for folders and files); manager adds new files and folders via smb(as she habits).

Zen photo give exactky what i need except one thing.

Albums scans properly, names are saVED but links to images and cache(cache also saves proper names in russian) in utf-8 acronims %D%E etc.

I create function for converting such thing(in similar project to resolve GET method for russian)

function unicon($str, $to_uni = true) {
$cp = Array (
"А"=>"%D0%90","а"=>"%D0%B0",
"Б"=>"%D0%91","б"=>"%D0%B1",
"В"=>"%D0%92","в"=>"%D0%B2",
"Г"=>"%D0%93","г"=>"%D0%B3",
"Д"=>"%D0%94","д"=>"%D0%B4",
"Е"=>"%D0%95","е"=>"%D0%B5",
"Ё"=>"%D0%81","ё"=>"%D1%91",
"Ж"=>"%D0%96","ж"=>"%D0%B6",
"З"=>"%D0%97","з"=>"%D0%B7",
"И"=>"%D0%98","и"=>"%D0%B8",
"Й"=>"%D0%99","й"=>"%D0%B9",
"К"=>"%D0%9A","к"=>"%D0%BA",
"Л"=>"%D0%9B","л"=>"%D0%BB",
"М"=>"%D0%9C","м"=>"%D0%BC",
"Н"=>"%D0%9D","н"=>"%D0%BD",
"О"=>"%D0%9E","о"=>"%D0%BE",
"П"=>"%D0%9F","п"=>"%D0%BF",
"Р"=>"%D0%A0","р"=>"%D1%80",
"С"=>"%D0%A1","с"=>"%D1%81",
"Т"=>"%D0%A2","т"=>"%D1%82",
"У"=>"%D0%A3","у"=>"%D1%83",
"Ф"=>"%D0%A4","ф"=>"%D1%84",
"Х"=>"%D0%A5","х"=>"%D1%85",
"Ц"=>"%D0%A6","ц"=>"%D1%86",
"Ч"=>"%D0%A7","ч"=>"%D1%87",
"Ш"=>"%D0%A8","ш"=>"%D1%88",
"Щ"=>"%D0%A9","щ"=>"%D1%89",
"Ъ"=>"%D0%AA","ъ"=>"%D1%8A",
"Ы"=>"%D0%AB","ы"=>"%D1%8B",
"Ь"=>"%D0%AC","ь"=>"%D1%8C",
"Э"=>"%D0%AD","э"=>"%D1%8D",
"Ю"=>"%D0%AE","ю"=>"%D1%8E",
"Я"=>"%D0%AF","я"=>"%D1%8F",
);

if ($to_uni) {
$str = strtr($str, $cp);
} else {
foreach ($cp as $c) {
$cpp[$c] = array_search($c, $cp);
}
$str = strtr($str, $cpp);
}

return $str;
}

So it works in other place but i need help to place it in zenphoto to fix URI to images using this function to convert "%D0%90"=>"А" (example)

If need additional explain please ask.

Comments

  • acrylian Administrator, Developer
    Zenphoto has a plugin name `seo_zenphoto` that "cleans" file and folder names from all sorts of special chars to plain A-Z chars. It does this on uploading via the backend but is of course bypassed if you upload via FTP directly.

    However, it is also possible to clean up afterwards using the `seo_cleanup` plugin. It is important not to do this via FTP because Zenphoto is file system based and scans the folder/files otherwise as new.

    Did you try these?

    It is known that a lot of servers don't work with such special chars on the file system (even my German ones generally don't like the German umlauts).
  • Dear acrylian, i read forum, use search - bat nothig helps me. Not any plugins(they all off from start) nothing. So i find solution by myself... I had to dig in your code:) May be my method isnt clean - but it works. Now i see thumbs properly. Only thing that wont work for now - its fullsize image but i working on it.
    Thats what ive done:

    functions-basic.php
    `

    1104: -function pathurlencode($path) {

    +function pathurlencode($path, $src = false) {

    ...

    1138: +

    if($src) $parts['path'] = iconv(FILESYSTEM_CHARSET, "utf-8", urldecode($parts['path']));

    `
    Here i add option IF SRC then decode path and convert from selected filesysem to utf-8. Then add this option like text "src" in template-functions.php for any '<img src="' with pathurlencode inside.

    Also edit i.php to show thumbs not only when cache exists but when loading too.
    `

    174 - $path = $protocol . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($newfilename));

    + $path = $protocol . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($newfilename), "src");

    `

    Done. Images shown as must. Repeat: Only thing that wont work for now - it is fullsize image but i working on it.

    May be devs looks at my shit-code and make some nice patch or plugin idk... i would glad to see it in better way :)

    Again my conditions:
    serever - Windows 2008 Standard Edition x64
    WAMP - EasyPHP 14.1 VLC9
    spec: folder albums is a symlink to folder with photos, where all paths in RUSSIAN and i cant change it.
  • Sounds like your server requires UTF-8 URIs. I know that Windows 7 does need this.

    Maybe you should select the option `UTF8 image URIs`. This might have been done for you if you had placed the recommended `charset_tést` file into the zp-data folder before running setup.

    Always a good idea to read and understand the warnings you have from the setup run.

    Of course modifying the Zenphoto code is a mistake. Your changes will simply get overwritten next time you upgrade.
  • Dear sbillard - i read warnings carefully and reinstall Zenphoto several times(i thought i miss something). And yes option UTF8 image URIs always enabled even at start of setup. I noticed - devs advices to turn on options or turn of - but options already in that state.

    And charset_tést - i READ this in warning. Script resoled my file-system as ISO-8859-1 and all symbols was bugged. As you probably know ISO-8859-1 didn't support Russian letters... So i gave to use manual set up this option to WINDOWS-1251(only this option give me write result while scan folders)

    In big deal - you should try first before you give such useless advice. I check it for you but you don't believe me.

    This script is exactly what i want but you sufficient russian users or devs - IDK.

    I try many ways, play with config, reinstall hundreds times and get same result: path to files shows correctly but THUMBS not.

    With manipulation above it become works. Please, give attention to this and may be you can give more "nice" solution?
  • Dear sbillard, i apologize for some critic, but bug was with don't saving option UTF8 image URIs - was checked but don't applied some why. I recheck option in DB and set UTF8_image_URI to 1...
    Now works without my interruptions.

    Why it happens idk. Hope i will find reason
Sign In or Register to comment.