forum.coppermine-gallery.net

No Support => Feature requests => Topic started by: fdcusa on February 08, 2015, 10:25:47 pm

Title: On selecting Filename => Title, allow chars ( ) ,
Post by: fdcusa on February 08, 2015, 10:25:47 pm
My filenames have parens, commas, and underlines in them.  After uploading files, the filename => Title option under Admin Tools gratiously copies the filename to the Title; however, it replaces ( with "28", ) with "29", and comma with "2C" (and underline to space).  I presume that is the hex ascii code.

Is it possible to modify the code allow parens and commas to pass through without change?
Title: Re: On selecting Filename => Title, allow chars ( ) ,
Post by: Αndré on February 09, 2015, 09:46:11 pm
Please re-check your file names after you've added them to your Coppermine gallery. Some time ago we decided to replace almost all non-alphanumerical characters in file names, for compatibility reasons:
Code: (include/functions.inc.php) [Select]
    $condition = array (
        'transliteration' => true,
        'special_chars' => true
    );
    $condition = CPGPluginAPI::filter('replace_forbidden_conditions', $condition);

    /**
     * Transliteration
     */
    if ($condition['transliteration']) {
        require_once('include/transliteration.inc.php');
        $return = transliteration_process($return, '_');
    }

    /**
     * Replace special chars
     */
    if ($condition['special_chars']) {
        $return = str_replace('%', '', rawurlencode($return));
    }

That's maybe too much for some people in some cases, so we added a plugin hook to disable either one or both methods.


I assume the "filename => title" feature works as expected, as the characters have already replaced in your file names. You maybe want to set $condition['special_chars'] to false for future file uploads.
Title: Re: On selecting Filename => Title, allow chars ( ) ,
Post by: fdcusa on February 09, 2015, 10:53:15 pm
Thank you, Αndré!   :)

Until I understand the code better I have disabled 'special_chars' as you suggested and no conversion is done. 

Yes, "filename => title" is working as advertised.