Beispiel #1
0
 public static function img_remove($path = '')
 {
     $s = strpos($path, '/');
     //если только имя файла
     if ($s === FALSE) {
         $path = PATH_ROOT . PATH_UPLOADS_IMAGES . DS . $path;
     } else {
         //если путь не содержит PATH_ROOT
         if (strpos($path, PATH_ROOT) === FALSE) {
             $path = PATH_ROOT . DS . $path;
         }
     }
     $path = str_replace('//', DS, $path);
     if (DS == '\\') {
         $path = str_replace('\\\\', DS, $path);
         $path = str_replace('\\/', DS, $path);
         $path = str_replace('/\\', DS, $path);
     }
     if (is_file($path)) {
         unlink($path);
     }
     $name = FILE::name($path);
     $ext = FILE::ext($path);
     $path = dirname($path);
     for ($i = 1; $i <= 10; $i++) {
         $path_small = $path . DS . 'small' . $i . '_' . $name . '.' . $ext;
         if (is_file($path_small)) {
             unlink($path_small);
         }
     }
 }