本文整理汇总了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;
}
示例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;
}
示例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);
}