You are here

function clean_filename in TinyBrowser 7

6 calls to clean_filename()
crop.php in tinybrowser/crop.php
edit.php in tinybrowser/edit.php
folders.php in tinybrowser/folders.php
resize.php in tinybrowser/resize.php
tinybrowser.php in tinybrowser/tinybrowser.php

... See full list

File

tinybrowser/fns_tinybrowser.php, line 297

Code

function clean_filename($filename) {
  $filename = preg_replace('/^\\W+|\\W+$/', '', $filename);

  // remove all non-alphanumeric chars at begin & end of string
  $filename = preg_replace('/\\s+/', '_', $filename);

  // compress internal whitespace and replace with _
  return preg_replace('/\\W-/', '', $filename);

  // remove all non-alphanumeric chars except _ and -
  // we do not want to change file name to all lower characters
  // because rename and other file operation fails due to file not found.
  // return strtolower(preg_replace('/\W-/', '', $filename)); // remove all non-alphanumeric chars except _ and -
}