當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。