当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtil::makeDirs方法代码示例

本文整理汇总了PHP中FileUtil::makeDirs方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::makeDirs方法的具体用法?PHP FileUtil::makeDirs怎么用?PHP FileUtil::makeDirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUtil的用法示例。


在下文中一共展示了FileUtil::makeDirs方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCropImg

 public function actionCropImg()
 {
     if (EnvUtil::submitCheck("userSubmit")) {
         $params = $_POST;
         if (!isset($params) && empty($params)) {
             return null;
         }
         $tempAvatar = $params["src"];
         $avatarPath = "data/avatar/";
         $avatarBig = UserUtil::getAvatar($params["uid"], "big");
         $avatarMiddle = UserUtil::getAvatar($params["uid"], "middle");
         $avatarSmall = UserUtil::getAvatar($params["uid"], "small");
         if (LOCAL) {
             FileUtil::makeDirs($avatarPath . dirname($avatarBig));
         }
         FileUtil::createFile("data/avatar/" . $avatarBig, "");
         FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
         FileUtil::createFile("data/avatar/" . $avatarSmall, "");
         Ibos::import("ext.ThinkImage.ThinkImage", true);
         $imgObj = new ThinkImage(THINKIMAGE_GD);
         $imgObj->open($tempAvatar)->crop($params["w"], $params["h"], $params["x"], $params["y"])->save($tempAvatar);
         $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
         $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
         $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
         $this->success(Ibos::lang("Upload avatar succeed"), $this->createUrl("home/personal", array("op" => "avatar")));
         exit;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:InfoController.php

示例2: actionCropBg

 public function actionCropBg()
 {
     if (EnvUtil::submitCheck("bgSubmit") && !empty($_POST["src"])) {
         $params = $_POST;
         if (!isset($params) && empty($params)) {
             return null;
         }
         $tempBg = $params["src"];
         $bgPath = "data/home/";
         $bgBig = UserUtil::getBg($params["uid"], "big");
         $bgMiddle = UserUtil::getBg($params["uid"], "middle");
         $bgSmall = UserUtil::getBg($params["uid"], "small");
         if (LOCAL) {
             FileUtil::makeDirs($bgPath . dirname($bgBig));
         }
         FileUtil::createFile("data/home/" . $bgBig, "");
         FileUtil::createFile("data/home/" . $bgMiddle, "");
         FileUtil::createFile("data/home/" . $bgSmall, "");
         Ibos::import("ext.ThinkImage.ThinkImage", true);
         $imgObj = new ThinkImage(THINKIMAGE_GD);
         if (!isset($params["noCrop"])) {
             $imgObj->open($tempBg)->crop($params["w"], $params["h"], $params["x"], $params["y"], 1000, 300)->save($tempBg);
         }
         $imgObj->open($tempBg)->thumb(1000, 300, 1)->save($bgPath . $bgBig);
         $imgObj->open($tempBg)->thumb(520, 156, 1)->save($bgPath . $bgMiddle);
         $imgObj->open($tempBg)->thumb(400, 120, 1)->save($bgPath . $bgSmall);
         if (isset($params["commonSet"]) && $params["commonSet"]) {
             $this->setCommonBg($bgPath . $bgBig);
         }
         $this->ajaxReturn(array("isSuccess" => true));
         exit;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:33,代码来源:SkinController.php

示例3: beforeSave

 protected function beforeSave()
 {
     $name = StringUtil::filterStr(EnvUtil::getRequest("name"));
     $url = StringUtil::filterStr(EnvUtil::getRequest("url"));
     $icon = StringUtil::filterStr(EnvUtil::getRequest("quicknavimg"));
     if (LOCAL) {
         FileUtil::makeDirs($this->_iconPath);
     }
     $saveName = StringUtil::random(16) . ".png";
     if (!empty($icon)) {
         $this->createImgIcon($icon, $saveName);
     } else {
         $val = EnvUtil::getRequest("fontvalue");
         $this->createColorImg($saveName, $val);
     }
     $data = array("name" => $name, "url" => $url, "description" => "", "icon" => $saveName);
     return $data;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:18,代码来源:QuicknavController.php

示例4: actionUpload

 public function actionUpload()
 {
     if ($_FILES["avatar"]) {
         $upload = FileUtil::getUpload($_FILES["avatar"]);
         if (!$upload->save()) {
             echo "出错了";
         } else {
             $info = $upload->getAttach();
             $file = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachment"];
             $fileUrl = FileUtil::fileName($file);
             $uid = Yii::app()->user->uid;
             $tempAvatar = $file;
             $avatarPath = "data/avatar/";
             $avatarBig = UserUtil::getAvatar($uid, "big");
             $avatarMiddle = UserUtil::getAvatar($uid, "middle");
             $avatarSmall = UserUtil::getAvatar($uid, "small");
             if (LOCAL) {
                 FileUtil::makeDirs($avatarPath . dirname($avatarBig));
             }
             FileUtil::createFile("data/avatar/" . $avatarBig, "");
             FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
             FileUtil::createFile("data/avatar/" . $avatarSmall, "");
             Yii::import("ext.ThinkImage.ThinkImage", true);
             $imgObj = new ThinkImage(THINKIMAGE_GD);
             $imgTemp = $imgObj->open($tempAvatar);
             $params = array("w" => $imgTemp->width(), "h" => $imgTemp->height(), "x" => "0", "y" => "0");
             if ($params["h"] < $params["w"]) {
                 $params["x"] = ($params["w"] - $params["h"]) / 2;
                 $params["w"] = $params["h"];
             } else {
                 $params["y"] = ($params["h"] - $params["w"]) / 2;
                 $params["h"] = $params["w"];
             }
             $imgObj->open($tempAvatar)->crop($params["w"], $params["h"], $params["x"], $params["y"])->save($tempAvatar);
             $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
             $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
             $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:40,代码来源:settingController.php

示例5: actionPostimg

 public function actionPostimg()
 {
     $upload = FileUtil::getUpload($_FILES["pmimage"], "mobile");
     if (!$upload->save()) {
         echo "出错了";
     } else {
         $info = $upload->getAttach();
         $file = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachment"];
         $fileUrl = FileUtil::fileName($file);
         $filePath = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachdir"];
         $filename = "tumb_" . $info["attachname"];
         if (LOCAL) {
             FileUtil::makeDirs($filePath . dirname($filename));
         }
         FileUtil::createFile($filePath . $filename, "");
         Yii::import("ext.ThinkImage.ThinkImage", true);
         $imgObj = new ThinkImage(THINKIMAGE_GD);
         $imgObj->open($fileUrl)->thumb(180, 180, 1)->save($filePath . $filename);
         $content = "<a href='" . $fileUrl . "'><img src='" . $filePath . $filename . "' /></a>";
         $id = intval(isset($_POST["pmid"]) ? $_POST["pmid"] : 0);
         $touid = intval(isset($_POST["pmtouid"]) ? $_POST["touid"] : 0);
         if (!$id && $touid) {
             $data = array("content" => $content, "touid" => $touid, "type" => 1);
             $res = MessageContent::model()->postMessage($data, Yii::app()->user->uid);
             $message = array("listid" => $res, "IsSuccess" => true);
         } else {
             $res = MessageContent::model()->replyMessage($id, $content, Yii::app()->user->uid);
             if ($res) {
                 $message = array("IsSuccess" => true, "data" => Ibos::lang("Private message send success"));
             } else {
                 $message = array("IsSuccess" => false, "data" => Ibos::lang("Private message send fail"));
             }
         }
         $this->ajaxReturn($message, "JSONP");
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:36,代码来源:PmController.php

示例6: checkDirExists

 protected function checkDirExists($module, $ymDir, $dayDir)
 {
     $type = $this->checkDirType($module);
     $baseDir = FileUtil::getAttachUrl();
     $dirs = $baseDir . "/" . $type . "/" . $ymDir . "/" . $dayDir;
     $res = is_dir($dirs);
     if (!$res) {
         $res = FileUtil::makeDirs($dirs);
     }
     return $res;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:11,代码来源:ICUpload.php

示例7: copyFile

 public static function copyFile($srcFile, $desFile, $type)
 {
     if (!is_file($srcFile)) {
         return false;
     }
     if ($type == "file") {
         FileUtil::makeDirs(dirname($desFile));
         copy($srcFile, $desFile);
     } elseif ($type == "ftp") {
         $ftpConf = EnvUtil::getRequest("ftp");
         $ftpConf["on"] = 1;
         $ftpConf["password"] = StringUtil::authcode($ftpConf["password"], "ENCODE", md5(Yii::app()->setting->get("config/security/authkey")));
         $ftp = FtpUtil::getInstance($ftpConf);
         $ftp->connect();
         $ftp->upload($srcFile, $desFile);
         if ($ftp->error()) {
             return false;
         }
     }
     return true;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:21,代码来源:UpgradeUtil.php

示例8: cropImg

 private function cropImg()
 {
     $uid = Ibos::app()->user->uid;
     $tempAvatar = $_POST["src"];
     $avatarPath = "data/avatar/";
     $avatarBig = UserUtil::getAvatar($uid, "big");
     $avatarMiddle = UserUtil::getAvatar($uid, "middle");
     $avatarSmall = UserUtil::getAvatar($uid, "small");
     if (LOCAL) {
         FileUtil::makeDirs($avatarPath . dirname($avatarBig));
     }
     FileUtil::createFile("data/avatar/" . $avatarBig, "");
     FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
     FileUtil::createFile("data/avatar/" . $avatarSmall, "");
     Ibos::import("ext.ThinkImage.ThinkImage", true);
     $imgObj = new ThinkImage(THINKIMAGE_GD);
     $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
     $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
     $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:20,代码来源:DefaultController.php


注:本文中的FileUtil::makeDirs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。