mosbth / cimage

Server-side image resizing and cropping on the fly with caching of generated image-files using PHP.
http://cimage.se/
MIT License
267 stars 43 forks source link

invalid source filename? #160

Closed szunyi closed 7 years ago

szunyi commented 7 years ago

hi,

if the remote filename contain bracket "(" or ")" then the script said: source filename contains invalid characters

how can i solve this problem?

thanks bye

mosbth commented 7 years ago

You can, through the configfile, edit the regexp that manages what characters are allowed in the filename. See here for the section to edit.

Perhaps something like this (uncomment and add ( and )).

/**
 * A regexp for validating characters in the image or alias filename.
 *
 * Default value:
 *  valid_filename:  '#^[a-z0-9A-Z-/_ \.:]+$#'
 *  valid_aliasname: '#^[a-z0-9A-Z-_]+$#'
 */
 'valid_filename'  => '#^[a-z0-9A-Z-/_ \.:()]+$#',
 //'valid_aliasname' => '#^[a-z0-9A-Z-_]+$#',
szunyi commented 7 years ago

Thanks! I need this for the round bracket so I modified and working with this:

#^[a-z0-9A-Z-/_ \.:\(\)]+$#