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