本文整理匯總了PHP中Thumbnail::makeNew方法的典型用法代碼示例。如果您正苦於以下問題:PHP Thumbnail::makeNew方法的具體用法?PHP Thumbnail::makeNew怎麽用?PHP Thumbnail::makeNew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Thumbnail
的用法示例。
在下文中一共展示了Thumbnail::makeNew方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rand
<?php
include_once "function.php";
include "common/thumbnail.class.php";
/*image upload*/
$img_name = $_FILES['image']['name'];
$img_type = $_FILES['image']['type'];
//echo $img_type;
if ($img_type == 'image/png' || $img_type == 'image/jpeg' || $img_type == 'image/gif' || $img_type == 'image/bmp') {
$image = rand(0, 999) . time() . $img_name;
$path = "../uploads/question_images/" . $image;
$tmp_name = $_FILES['image']['tmp_name'];
if (move_uploaded_file($tmp_name, $path)) {
$pic = new Thumbnail();
$pic->filename = "../uploads/question_images/" . $image;
$pic->filename2 = "../uploads/question_images/question_images_thumb/thumb_" . $image;
$pic->maxW = 400;
$pic->maxH = 350;
$pic->SetNewWH();
$pic->makeNew();
$pic->FinirPImage();
$image1 = "thumb_" . $image;
$httphost = $_SERVER['HTTP_ORIGIN'];
if ($_SERVER['HTTP_ORIGIN'] == 'http://localhost') {
$httphost = $_SERVER['HTTP_ORIGIN'] . '/Learnquixweb/';
}
die(json_encode(array("status" => "1", "server" => $httphost, "img_path" => $httphost . "/uploads/question_images/question_images_thumb/" . $image1)));
}
}
die(json_encode(array("status" => "0")));