コード例 #1
0
ファイル: Listing.php プロジェクト: andreyvit/retester
 /**
  * create directory
  *
  * @param string $dir		directory path
  * @return boolean
  */
 function mkDir($dir)
 {
     return $this->FileSystem->makeDir($dir);
 }
コード例 #2
0
ファイル: FileCache.class.php プロジェクト: jc3wish/xlogger
 /**
  * 获取缓存文件路径及文件名
  * @param string $key 键名
  * @return string
  */
 function makeFilename($key)
 {
     $pos = strrpos($key, '/');
     $path = $this->cachePath;
     if ($pos !== false) {
         $path .= substr($key, 0, $pos);
         $key = substr($key, $pos + 1);
     }
     !is_dir($path) && FileSystem::makeDir($path);
     return $path . '/' . urlencode($key) . '.cache.php';
 }
コード例 #3
0
 /**
  * 将裁剪好的头像从临时目录转移到正式目录
  *
  * @param int $userid 用户ID
  * @param boolean $flag false时表示保存图片并删除临时目录中图片,true时表示删除临时目录中的图片并不保存
  * @return string 操作正常返回succ,否则error
  */
 public static function saveHead($user_id)
 {
     import("util.FileSystem");
     // 移动图片
     for ($i = 0; $i < 5; $i++) {
         $src_file = self::TEMP_CUT_DIR . '/' . "{$user_id}" . '_' . $i . ".jpg";
         if (!file_exists($src_file)) {
             return false;
         }
         $dest_dir = self::CUT_DIR . headCut($user_id);
         if (!is_dir($dest_dir)) {
             FileSystem::makeDir($dest_dir);
         }
         $dest_file = $dest_dir . '/' . "{$user_id}" . '_' . $i . ".jpg";
         if (!copy($src_file, $dest_file)) {
             return false;
         }
     }
     return true;
 }