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


PHP image::handleAllUploads方法代码示例

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


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

示例1: processAvatar

 public static function processAvatar($uid)
 {
     $imageProcessor = new image(200, 200);
     system::ensureDirectory(CONTENT_PATH . "/avatars/{$uid}");
     $expectedPics = array("avatar" => CONTENT_PATH . "/avatars/{$uid}");
     $imageProcessor->handleAllUploads($expectedPics);
     return $expectedPics;
 }
开发者ID:ygres,项目名称:sblog,代码行数:8,代码来源:model.user.php

示例2: uploadOnePicture

 public static function uploadOnePicture($postName, $postDir = "postImages")
 {
     if (!empty($_POST["picWidth"])) {
         $width = intval($_POST["picWidth"]);
     } else {
         $width = 200;
     }
     if (!empty($_POST["picHeight"])) {
         $heigth = intval($_POST["picHeight"]);
     } else {
         $heigth = 200;
     }
     $path = CONTENT_PATH . "/{$postDir}/{$postName}/";
     if (!is_dir($path) || system::dirIsEmpty($path)) {
         //blog::saveDraft();
         if (!is_dir($path)) {
             mkdir($path, 0777, true);
         }
     }
     $imageProcessor = new image($width, $heigth);
     if ($postDir == "posterImages") {
         $imageProcessor->additionalProcessing("poster", 640, 0);
     }
     $expectedPics = array("picUpld" => $path . time(), "poster" => $path . $postName);
     $imageProcessor->handleAllUploads($expectedPics);
     return $expectedPics;
 }
开发者ID:ygres,项目名称:sblog,代码行数:27,代码来源:model.blog.php

示例3: upload

 function upload()
 {
     system::$display = false;
     $response = array();
     if (!isset($_POST["token"]) && !$_POST["token"]) {
         $response["error"] = "Token error";
     }
     $token = preg_replace("/[^0-9a-z\\_\\-+\\/\\\\|]/i", '', $_POST["token"]);
     if (!$token) {
         $response["error"] = "Token error";
     }
     $mysql = $this->db->query("SELECT * FROM `tokens` as t, `users` as u WHERE u.`userID`=t.`userID` AND t.`token`='?' LIMIT 1", $token);
     if (!$mysql->getNumRows()) {
         $response["error"] = "Token error";
     }
     if (isset($response["error"])) {
         echo json_encode($response);
         return;
     }
     $userData = $mysql->fetch();
     if (isset($_FILES["screenshot"]) && $_FILES["screenshot"]) {
         $imageProcessor = new image(200, 200);
         $path = CONTENT_PATH . "/screenshots/" . $userData["userID"];
         system::ensureDirectory($path);
         $time = explode(" ", microtime());
         $time[0] = str_replace("0.", '', $time[0]);
         $response["screenshot"] = $path . "/" . implode("_", $time);
         $imageProcessor->handleAllUploads($response);
     } else {
         $response["error"] = "Where is no `screenshot` field in your multipart request. Nothing to do.";
     }
     $response["screenshot"]["userID"] = intval($userData["userID"]);
     echo json_encode($response);
 }
开发者ID:ygres,项目名称:sblog,代码行数:34,代码来源:index.php


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