本文整理汇总了PHP中mPDF::Thumbnail方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::Thumbnail方法的具体用法?PHP mPDF::Thumbnail怎么用?PHP mPDF::Thumbnail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::Thumbnail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mPDF
<?php
include_once "../mpdf.php";
$mpdf = new mPDF();
$mpdf->SetImportUse();
$mpdf->Thumbnail('sample_orientation2.pdf', 4, 5);
// number per row // spacing in mm
$mpdf->WriteHTML('<pagebreak /><div>Now with rotated pages</div>');
$mpdf->Thumbnail('sample_orientation3.pdf', 4);
// number per row // spacing in mm
$mpdf->Output();
exit;
示例2: uploadfile
public function uploadfile()
{
$folder = isset($_GET['folder']) ? $_GET['folder'] : 'others';
$targetFolder = "/upload_file/{$folder}";
$prefix = time();
$setting = $this->general_model->get_email_from_setting();
$type = explode(",", $setting[0]['download_type']);
foreach ($type as $key => $value) {
$type[$key] = strtolower($value);
}
$userid = $_SESSION['user']['user_id'];
if (!empty($_FILES)) {
$_FILES["Filedata"]["name"] = str_replace(' ', '', $_FILES["Filedata"]["name"]);
$_FILES["Filedata"]["tmp_name"] = str_replace(' ', '', $_FILES["Filedata"]["tmp_name"]);
$uploaddatafile1 = md5($_FILES["Filedata"]["name"]);
$tempFile = $_FILES["Filedata"]["tmp_name"];
$targetPath = $_SERVER["DOCUMENT_ROOT"] . $targetFolder;
$targetFile = rtrim($targetPath, "/") . "/" . $_FILES["Filedata"]["name"];
$fileTypes = $type;
//array("zip","rar");
$fileParts = pathinfo($_FILES["Filedata"]["name"]);
if (in_array(strtolower($fileParts["extension"]), $fileTypes)) {
move_uploaded_file($tempFile, $targetFile);
if (isset($_GET['w'])) {
$w = $_GET['w'];
} else {
$w = 100;
}
if (isset($_GET['h'])) {
$h = $_GET['h'];
} else {
$h = 100;
}
$path_upload = "upload_file/{$folder}/" . $_FILES["Filedata"]["name"];
$root = dirname(dirname(dirname(__FILE__)));
$file = '/' . $path_upload;
//a reference to the file in reference to the current working directory.
// Process for image
$image_info = @getimagesize(base_url() . $path_upload);
if (!empty($image_info)) {
$image = true;
} else {
$image = false;
}
if ($image) {
if (!isset($_SESSION['fileuploadname'])) {
$_SESSION['fileuploadname'] = $_FILES["Filedata"]["name"];
$_SESSION['fileuploadhtml'] = '';
} else {
if (empty($_SESSION['fileuploadname'])) {
$_SESSION['fileuploadname'] = $_FILES["Filedata"]["name"];
$_SESSION['fileuploadhtml'] = '';
}
}
$_SESSION['fileuploadhtml'] .= '<img src="' . base_url() . $path_upload . '" style="width:850px;"/>';
echo "2";
exit;
}
include $root . "/mpdf/mpdf.php";
require_once $root . "/scribd.php";
$scribd_api_key = "766ydp7ellofhr7x027wl";
$scribd_secret = "sec-7zrz2fxxa2chak965tbp67npqw";
$scribd = new Scribd($scribd_api_key, $scribd_secret);
$doc_type = null;
$access = "private";
$rev_id = null;
$data = $scribd->upload($file, $doc_type, $access, $rev_id);
if (!empty($data)) {
$result = 0;
while ($result == 0) {
echo $result = $scribd->getDownloadLinks($data['doc_id']);
}
file_put_contents('/upload_file/files/c' . $uploaddatafile1 . ".pdf", fopen($result["download_link"], 'r'));
//file_put_contents( fopen($result["download_link"], 'r'));
$mpdf = new mPDF();
$mpdf->SetImportUse();
$pagecount = $mpdf->SetSourceFile('/upload_file/files/r' . $uploaddatafile1 . ".pdf");
$tplId = $mpdf->ImportPage(1);
$mpdf->UseTemplate($tplId);
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetWatermarkText(' ');
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->showWatermarkText = true;
$md5 = $uploaddatafile1;
$mpdf->Output('/upload_file/files/' . $md5 . '.pdf', '');
$mpdf->Thumbnail('/upload_file/files/' . $md5 . '.pdf', 1);
$mpdf->Output('/upload_file/files/' . $md5 . '.pdf', '');
unlink('/upload_file/files/c' . $uploaddatafile1 . ".pdf");
$im = new imagick();
$im->readimage('/upload_file/files/' . $md5 . '.pdf');
//$im->readimage('/upload_file/files/'.$md5.'.pdf');
$im->setImageCompressionQuality(0);
$im->setImageFormat('jpeg');
$im->writeImage('/upload_file/images/r' . $md5 . '.jpg');
$this->db->set('id', $userid);
$this->db->set('fullpdf', '/upload_file/files/r' . $uploaddatafile1 . '.pdf');
$this->db->set('pdf', '/upload_file/files/' . $md5 . '.pdf');
$this->db->set('image', '/upload_file/images/r' . $md5 . '.jpg');
$this->db->insert('scribe');
$im->clear();
//.........这里部分代码省略.........