mirror of
https://github.com/e107inc/e107.git
synced 2025-08-11 00:54:49 +02:00
Fixes related to Gallery image import, watermarks and thumbnails.
This commit is contained in:
@@ -122,6 +122,31 @@ class e_file
|
||||
$this->fileFilter = $filter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean and rename file name
|
||||
* @param $f array as returned by get_files();
|
||||
* @param $rename boolean - set to true to rename file.
|
||||
*/
|
||||
public function cleanFileName($f,$rename=false)
|
||||
{
|
||||
$fullpath = $f['path'].$f['fname'];
|
||||
$newfile = preg_replace("/[^a-z0-9-\.]/", "-", strtolower($f['fname']));
|
||||
$newpath = $f['path'].$newfile;
|
||||
|
||||
if($rename == true)
|
||||
{
|
||||
|
||||
if(!rename($fullpath,$newpath))
|
||||
{
|
||||
$f['error'] = "Couldn't rename $fullpath to $newpath";
|
||||
}
|
||||
}
|
||||
|
||||
$f['fname'] = $newfile;
|
||||
|
||||
return $f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read files from given path
|
||||
|
Reference in New Issue
Block a user