本文整理汇总了PHP中Thumbnail::FinirPImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Thumbnail::FinirPImage方法的具体用法?PHP Thumbnail::FinirPImage怎么用?PHP Thumbnail::FinirPImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thumbnail
的用法示例。
在下文中一共展示了Thumbnail::FinirPImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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")));
示例2: fbauth
//.........这里部分代码省略.........
$affs = $me['affiliations'];
$schoolid = -1;
$affs2 = array_reverse($affs);
if (is_array($affs2[0])) {
foreach ($affs2 as $indaff) {
if ($indaff['type'] == "college") {
$schoolid = $indaff['nid'];
$schoolname = $indaff['name'];
break;
}
}
}
if ($me['id'] == "100002408771848") {
$schoolid = -1;
}
if ($schoolid == "16777217") {
$schoolid = 1;
}
$checkschool = "select name from school where id='" . $schoolid . "'";
$db = new Database();
$db->query($checkschool);
$result = $db->getresult();
if (strlen($result['name'] < 1)) {
$insertschool = "insert into school set id='" . $schoolid . "', name='" . $schoolname . "'";
$db->query($insertschool);
}
if ($me['gender'] == 'male') {
$sex = 2;
} else {
$sex = 1;
}
$defaultpicture = "http://graph.facebook.com/" . $me['id'] . "/picture?type=large";
$contents = file_get_contents($defaultpicture);
$target_path = "/home/newportb/public_html/photos/";
$firstsubset = rand(100000, 9999999);
$secondsubset = rand(100000, 9999999);
$thirdsubset = rand(1000000, 99989999);
$generated_path = $target_path . $firstsubset . "_" . $secondsubset . "_" . $thirdsubset . "_n.jpg";
while (file_exists($generated_path)) {
$firstsubset = rand(100000, 9999999);
$secondsubset = rand(100000, 9999999);
$thirdsubset = rand(1000000, 99989999);
$generated_path = $target_path . $firstsubset . "_" . $secondsubset . "_" . $thirdsubset . "_n.jpg";
}
$full_target_path = $target_path . $firstsubset . "_" . $secondsubset . "_" . $thirdsubset . "_f.jpg";
file_put_contents($full_target_path, $contents);
//NORMAL
$pic3 = new Thumbnail();
$pic3->filename = $full_target_path;
$pic3->filename2 = $target_path . $firstsubset . "_" . $secondsubset . "_" . $thirdsubset . "_n.jpg";
$pic3->maxW = 170;
$pic3->maxH = 400;
$pic3->Text = "";
$pic3->SetNewWH();
$pic3->MakeNew();
$pic3->FinirPImage();
//SEARCH
$pic2 = new Thumbnail();
$pic2->filename = $full_target_path;
$pic2->filename2 = $target_path . $firstsubset . "_" . $secondsubset . "_" . $thirdsubset . "_s.jpg";
$pic2->maxW = 100;
$pic2->maxH = 200;
$pic2->Text = "";
$pic2->SetNewWH();
$pic2->MakeNew();
$pic2->FinirPImage();
//THUMBNAIL
$pic2 = new Thumbnail();
$pic2->filename = $full_target_path;
$pic2->filename2 = $target_path . $firstsubset . "_" . $secondsubset . "_" . $thirdsubset . "_t.jpg";
$pic2->maxW = 50;
$pic2->maxH = 50;
$pic2->Text = "";
$pic2->SetNewWH();
$pic2->MakeNew();
$pic2->FinirPImage();
unlink($full_target_path);
$registerdate = date("Y-m-d");
$dtime = date('Y-m-d H:i:s');
$me['name'] = str_replace("'", "'", $me['name']);
if ($accountstatusid != 1) {
$newfbuser = "INSERT INTO `user` \n\t\t\t\t\t(`id`, `email`, `password`, `accountstatusid`, `registerdate`, `name`, `schoolid`, `phone`, \n\t\t\t\t\t`phoneproviderid`, `graduationyear`, `schoolstatusid`, `sexid`, `residenceid`, `birthday`, \n\t\t\t\t\t`hometown`, `highschoolid`, `screennameid`, `websites`, `politicalid`)\n\t\t\t\t\tVALUES \n\t\t\t\t\t('" . $me['id'] . "', '" . $me['email'] . "', 'fblogin', '2', '" . $registerdate . "', '" . $me['name'] . "', '" . $schoolid . "', '', '', '', '1', '" . $sex . "', '', '" . $me['birthday'] . "', '', '', '', '', '');";
} else {
$newfbuser = "UPDATE `user` SET\n\t\t\t\t\t`email`='" . $me['email'] . "',\n\t\t\t\t\t`accountstatusid`='2', \n\t\t\t\t\t`registerdate`='" . $registerdate . "', \n\t\t\t\t\t`schoolid`='" . $schoolid . "', \n\t\t\t\t\t`schoolstatusid`='1', \n\t\t\t\t\t`sexid`='" . $sex . "', \n\t\t\t\t\t`birthday`='" . $me['birthday'] . "'\n\t\t\t\t\tWHERE `id`='" . $me['id'] . "' LIMIT 1\n\t\t\t\t\t";
}
$updateprofile = "insert into `profileupdates` (`id`, `userid`, `timestamp`) VALUES (NULL, '" . $me['id'] . "', '" . $dtime . "');";
$setpicture = "insert into `picture` (`userid`, `albumid`, `link`) VALUES ('" . $me['id'] . "', '0', '" . $firstsubset . "_" . $secondsubset . "_" . $thirdsubset . "');";
$site = new site();
if ($site->get_setting('email_alerts') == 1) {
$body = "Name: " . $me['name'] . ".<br>Email: " . $me['email'];
email::send('reports@harvardconnection.co', 'New Registration', $body);
}
$db->query($newfbuser);
$db->query($updateprofile);
$db->query($setpicture);
$this->newuser = true;
$this->fbauth($me);
return true;
}
}