本文整理汇总了PHP中imagick类的典型用法代码示例。如果您正苦于以下问题:PHP imagick类的具体用法?PHP imagick怎么用?PHP imagick使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了imagick类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: cdm_thumbPdf
function cdm_thumbPdf($pdf)
{
if (class_exists('imagick')) {
$upload_dir = wp_upload_dir();
$tmp_folder = $upload_dir['basedir'] . '/imageMagick_tmp/';
if (!is_dir($tmp_folder)) {
mkdir($tmp_folder, 0777);
}
$tmp = $tmp_folder;
$format = "png";
$source = $pdf;
$dest = "" . $pdf . "_big.{$format}";
$dest2 = "" . $pdf . "_small.{$format}";
// read page 1
$im = new imagick('' . $source . '[0]');
// convert to jpg
$im->setImageColorspace(255);
$im->setImageFormat($format);
//resize
$im->resizeImage(650, 650, imagick::FILTER_LANCZOS, 1);
//write image on server
$im->writeImage($dest);
//resize
$im->resizeImage(250, 250, imagick::FILTER_LANCZOS, 1);
//write image on server
$im->writeImage($dest2);
$im->clear();
$im->destroy();
} else {
echo 'php-image-magick not installed. Please disable the pdf thumbnail options or install the php extention correctly.';
exit;
}
}
开发者ID:beafus,项目名称:Living-Meki-Platform,代码行数:33,代码来源:functions.php
示例2: processPdf
public function processPdf($fileNames)
{
$mpdf = Yii::app()->ePdf->mpdf();
$mpdf->SetImportUse();
$pagecount = $mpdf->SetSourceFile('../' . $fileNames['pdf']);
if ($pagecount > 3) {
for ($i = 1; $i <= 3; $i++) {
if ($i != 1) {
$mpdf->AddPage();
}
$import_page = $mpdf->ImportPage($i);
// add last 3 page
$mpdf->UseTemplate($import_page);
}
} else {
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
}
$mpdf->Output('../' . Extensions::FILE_PDF_PREVIEW_PATH . $fileNames['pdfPreview'], 'F');
$im = new imagick();
$im->readimage('/home/notesgen/public_html/' . Extensions::FILE_PDF_PREVIEW_PATH . $fileNames['pdfPreview']);
$im->setImageCompressionQuality(0);
$im->setImageFormat('jpeg');
$im->writeImage('../' . Extensions::FILE_IMAGE_PATH . $fileNames['image']);
$im->setImageCompressionQuality(80);
$im->writeImage('../' . Extensions::FILE_IMAGE_PATH_APP . $fileNames['image']);
$im->clear();
$im->destroy();
}
开发者ID:kuldeepro,项目名称:notesgen,代码行数:29,代码来源:CronController.php
示例3: pdf2png
function pdf2png($PDF,$Path){
if(!extension_loaded('imagick')){
echo 'no imagick';
return false;
}
if(!file_exists($PDF)){
echo 'no file';
return false;
}
$IM = new imagick();
echo 'image create';
// $IM->setResolution(794,1123);
// echo 'image resolution';
$IM->setCompressionQuality(100);
echo 'image quality';
$IM->readImage($PDF);
echo 'pdf read';
foreach ($IM as $Key => $Var){
echo 'image convert';
$Var->setImageFormat('png');
$Filename = $Path.'/'.md5($Key.time()).'.png';
if($Var->writeImage($Filename) == true){
$Return[] = $Filename;
}
}
return $Return;
}
开发者ID:arfanty,项目名称:acp,代码行数:28,代码来源:testValidate.php
示例4: getThumbnail
/**
* {@inheritDoc}
*/
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
{
$this->initCmd();
if (is_null($this->cmd)) {
return false;
}
$absPath = $fileview->toTmpFile($path);
$tmpDir = \OC::$server->getTempManager()->getTempBaseDir();
$defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
$clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
$exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
shell_exec($exec);
//create imagick object from pdf
$pdfPreview = null;
try {
list($dirname, , , $filename) = array_values(pathinfo($absPath));
$pdfPreview = $dirname . '/' . $filename . '.pdf';
$pdf = new \imagick($pdfPreview . '[0]');
$pdf->setImageFormat('jpg');
} catch (\Exception $e) {
unlink($absPath);
unlink($pdfPreview);
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
return false;
}
$image = new \OC_Image();
$image->loadFromData($pdf);
unlink($absPath);
unlink($pdfPreview);
if ($image->valid()) {
$image->scaleDownToFit($maxX, $maxY);
return $image;
}
return false;
}
开发者ID:loulancn,项目名称:core,代码行数:38,代码来源:office.php
示例5: makethumb
function makethumb($srcFile, $dstFile, $dstW, $dstH, $imwf = false)
{
$im = new imagick($srcFile);
$source_w = $im->getImageWidth();
$source_h = $im->getImageHeight();
if ($dstW === 0 && $dstH === 0) {
$dstW = $source_w;
$dstH = $source_h;
} else {
// 取得縮在此範圍內的比例
$percent = getResizePercent($source_w, $source_h, $dstW, $dstH);
$dstW = $source_w * $percent;
$dstH = $source_h * $percent;
}
$im->thumbnailImage($dstW, $dstH);
$im->writeImage($dstFile);
$watermarkFile = './logo.png';
if ($imwf && is_file($watermarkFile) && is_file($dstFile)) {
$image = new imagick($dstFile);
$watermark = new imagick($watermarkFile);
$iWidth = $image->getImageWidth();
$iHeight = $image->getImageHeight();
$wWidth = $watermark->getImageWidth();
$wHeight = $watermark->getImageHeight();
if ($iHeight < $wHeight || $iWidth < $wWidth) {
$watermark->scaleImage($iWidth, $iHeight);
$wWidth = $watermark->getImageWidth();
$wHeight = $watermark->getImageHeight();
}
$x = ($iWidth - $wWidth) / 2;
$y = ($iHeight - $wHeight) / 2;
$image->compositeImage($watermark, imagick::COMPOSITE_OVER, $x, $y);
$image->writeImage($dstFile);
}
}
开发者ID:FantasticThought,项目名称:tfsda,代码行数:35,代码来源:image_conver.php
示例6: getThumbnail
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
{
$this->initCmd();
if (is_null($this->cmd)) {
return false;
}
$absPath = $fileview->toTmpFile($path);
$tmpDir = get_temp_dir();
$defaultParameters = ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ';
$clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
$exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
$export = 'export HOME=/' . $tmpDir;
shell_exec($export . "\n" . $exec);
//create imagick object from pdf
try {
$pdf = new \imagick($absPath . '.pdf' . '[0]');
$pdf->setImageFormat('jpg');
} catch (\Exception $e) {
unlink($absPath);
unlink($absPath . '.pdf');
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
return false;
}
$image = new \OC_Image();
$image->loadFromData($pdf);
unlink($absPath);
unlink($absPath . '.pdf');
return $image->valid() ? $image : false;
}
开发者ID:olucao,项目名称:owncloud-core,代码行数:29,代码来源:office-cl.php
示例7: thumbnail
function thumbnail($file, $width = '120')
{
$name = $this->_dir . DS . $file . '[0]';
$im = new imagick($name);
$im->setImageFormat('jpg');
$im->scaleImage($width, 0);
header('Content-Type: image/jpeg');
echo $im;
}
开发者ID:agus-ariyanto,项目名称:koio,代码行数:9,代码来源:pdf.php
示例8: pdftoimage
function pdftoimage($file, $page)
{
$filepart = pathinfo($file);
$save_to = $filepart['filename'] . ".jpg";
$im = new imagick($file[$page - 1]);
$im->thumbnailImage(800, 0);
$im->setImageFormat('jpg');
$im = $im->flattenImages();
file_put_contents($save_to, $im);
}
开发者ID:bramleksono,项目名称:mobileid-SI,代码行数:10,代码来源:pdfoperation.php
示例9: createThumb
private function createThumb($filePath, $fileName)
{
if (!extension_loaded('imagick')) {
$errorMessage = "Error: 874";
$this->error($errorMessage);
}
try {
$fileNameWithoutExt = $fileName;
$imagePreview = new imagick($this->uploadsDir . $fileName);
$imagePreview->scaleImage(300, 0);
$imagePreview->writeImage($this->thumbDir . $fileNameWithoutExt);
} catch (ImagickException $e) {
$errorMessage = "Error: 3435";
$this->error($errorMessage);
}
return $fileNameWithoutExt;
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:17,代码来源:file_uploader.php
示例10: getThumbnail
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
{
$tmpPath = $fileview->toTmpFile($path);
//create imagick object from pdf
try {
$pdf = new \imagick($tmpPath . '[0]');
$pdf->setImageFormat('jpg');
} catch (\Exception $e) {
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
return false;
}
unlink($tmpPath);
//new image object
$image = new \OC_Image($pdf);
//check if image object is valid
return $image->valid() ? $image : false;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:17,代码来源:pdf.php
示例11: create_img_frompdf
/**
* class_make_file::create_img_frompdf()
*
* @param mixed $pdf_org
* @param mixed $pfadhier
* @return
*/
private function create_img_frompdf($pdf_org, $pfadhier)
{
setlocale(LC_ALL, "de_DE");
//Klasse INI
$im = new imagick();
//Auflösung
$im->setResolution(60, 60);
//Anzahl der Seiten des PDFs
$pages = $this->getNumPagesInPDF($pfadhier . $pdf_org);
//Dann alle Seiten durchlaufen und Bilder erzeugen
for ($i = 0; $i < $pages; $i++) {
//Maximal 100 Seiten
if ($i > 100) {
continue;
}
//Seitenzahl festlegen
$pdf = $pfadhier . $pdf_org . "[" . $i . "]";
//auslesen
if (file_exists($pfadhier . $pdf_org)) {
try {
$im->readImage($pdf);
} catch (Exception $e) {
echo 'Exception abgefangen: ', $e->getMessage(), "\n";
}
if (empty($e)) {
//die ("NIX");
$im->setImageColorspace(255);
$im->setCompression(Imagick::COMPRESSION_JPEG);
$im->setCompressionQuality(60);
$im->setImageFormat('jpg');
$im->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
//Damti testweise ausgeben
#header( "Content-Type: image/png" );
#echo $im;
#exit();
$pdf_img = str_replace(".pdf", "", $pdf_org);
$pdf_img = str_replace("/files/pdf/", "", $pdf_img);
$im->setImageFileName($pfadhier . "files/images/thumbs/" . $pdf_img . "_" . $i . ".jpg");
//Pfade saven
echo $image_files[] = $pfadhier . "files/images/thumbs/" . $pdf_img . "_" . $i . ".jpg";
//Speichern
$im->writeImage();
ini_set(Display_errors, "1");
}
//Noch verkleinern... image_magick macht die Bilder zu groß
/**
$image = new SimpleImage();
$image->load($pfadhier."files/images/thumbs/".$pdf_img."_".$i.".jpg");
$image->resizeToHeight(300);
$image->save($pfadhier."files/images/thumbs/".$pdf_img."_".$i."x.jpg");
unlink($pfadhier."files/images/thumbs/".$pdf_img."_".$i.".jpg");
echo ($pfadhier."files/images/thumbs/".$pdf_img."_".$i."x.jpg");
*/
}
}
return $image_files;
}
开发者ID:xavit,项目名称:OffenesBonn,代码行数:64,代码来源:makefile.php
示例12: getThumbnail
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
{
require_once 'PHPExcel/Classes/PHPExcel.php';
require_once 'PHPExcel/Classes/PHPExcel/IOFactory.php';
$absPath = $fileview->toTmpFile($path);
$tmpPath = \OC_Helper::tmpFile();
$rendererName = \PHPExcel_Settings::PDF_RENDERER_DOMPDF;
$rendererLibraryPath = \OC::$THIRDPARTYROOT . '/3rdparty/dompdf';
\PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath);
$phpexcel = new \PHPExcel($absPath);
$excel = \PHPExcel_IOFactory::createWriter($phpexcel, 'PDF');
$excel->save($tmpPath);
$pdf = new \imagick($tmpPath . '[0]');
$pdf->setImageFormat('jpg');
unlink($absPath);
unlink($tmpPath);
$image = new \OC_Image();
$image->loadFromData($pdf);
return $image->valid() ? $image : false;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:20,代码来源:office-fallback.php
示例13: generate
private function generate()
{
$taken_seats_result = $this->seatbooking->get_taken_seats_ids();
$taken_seats = array();
foreach ($taken_seats_result as $seat) {
$taken_seats[$seat] = 0;
}
$coords = $this->load_xmlconfig_to_array();
$taken_seats_coords = array_intersect_key($coords, $taken_seats);
$bg = new imagick($this->filename_bg);
$marker = new imagick($this->filename_marker);
$marker_width = $marker->getImageWidth();
$marker_height = $marker->getImageHeight();
foreach ($taken_seats_coords as $seat) {
$x = $seat[0] - floor($marker_width / 2);
$y = $seat[1] - floor($marker_width / 2);
$bg->compositeImage($marker, imagick::COMPOSITE_OVER, $x, $y);
}
return $bg;
}
开发者ID:bjornua,项目名称:dikulan-old,代码行数:20,代码来源:StatusImage.php
示例14: pigen_generate
function pigen_generate($file)
{
// Generate thumbnail from PDF
$file_basename = str_replace('.', '-', basename($file));
$file_url = str_replace(basename($file), $file_basename . '.jpg', $file);
$opt = get_option('_pigen_verify_imagick');
if ($opt == 'imagick') {
$im = new imagick();
$im->readimage($file . '[0]');
$im->setImageBackgroundColor('white');
$im = $im->flattenImages();
$im->setImageFormat('jpg');
$im->writeImage($file_url);
$im->clear();
$im->destroy();
} else {
exec("convert {$file}[0] -density 72 -quality 90 -background white -flatten {$file_url}");
// converte files to jpg
}
return $file_url;
}
开发者ID:subhadip-sahoo,项目名称:wp-project1,代码行数:21,代码来源:pdf-image-generator.php
示例15: pdftojpg
function pdftojpg($pdfFile, $jpgFile)
{
/*
* imagemagick and php5-imagick required
*
* all options for imagick:
* http://php.net/manual/fr/class.imagick.php
*
*/
$pdf_file = $pdfFile;
$save_to = $jpgFile;
$img = new imagick();
//this must be called before reading the image, otherwise has no effect - "-density {$x_resolution}x{$y_resolution}"
//this is important to give good quality output, otherwise text might be unclear
$img->setResolution(200, 200);
//read the pdf
$img->readImage("{$pdf_file}[0]");
//reduce the dimensions - scaling will lead to black color in transparent regions
$img->scaleImage(1920, 1080);
//set new format
$img->setCompressionQuality(80);
$img->setImageFormat('jpg');
// -flatten option, this is necessary for images with transparency, it will produce white background for transparent regions
$img = $img->flattenImages();
//save image file
$img->writeImages($save_to, false);
//clean
$img->clear();
$img->destroy();
}
开发者ID:beemoon,项目名称:signage,代码行数:30,代码来源:function.php
示例16: generatePreviewImage
public function generatePreviewImage($pdfFile, $saveTo)
{
try {
$img = new imagick(Director::getAbsFile($pdfFile) . "[0]");
//we only take first page
// -flatten option, this is necessary for images with transparency, it will produce white background for transparent regions
$img->setImageAlphaChannel(11);
//Imagick::ALPHACHANNEL_REMOVE has been added in 3.2.0b2
$img->mergeImageLayers(imagick::LAYERMETHOD_FLATTEN);
//set new format
//@Todo detect format from filename
$img->setImageFormat('jpg');
$img->setCompressionQuality(100);
//save image file
$img->writeImages($saveTo, false);
} catch (\Exception $e) {
error_log($e->getMessage());
return false;
}
return true;
}
开发者ID:ivoba,项目名称:silverstripe-simple-pdf-preview,代码行数:21,代码来源:SimplePdfPreviewImagickGenerator.php
示例17: imgRotate
/**
* Rotate image
*
* @param string $path image file
* @param int $degree rotete degrees
* @param string $bgcolor square background color in #rrggbb format
* @param string $destformat image destination format
* @return string|false
* @author nao-pon
* @author Troex Nevelin
**/
protected function imgRotate($path, $degree, $bgcolor = '#ffffff', $destformat = null)
{
if (($s = @getimagesize($path)) == false) {
return false;
}
$result = false;
switch ($this->imgLib) {
case 'imagick':
try {
$img = new imagick($path);
} catch (Exception $e) {
return false;
}
$img->rotateImage(new ImagickPixel($bgcolor), $degree);
$result = $img->writeImage($path);
return $result ? $path : false;
break;
case 'gd':
if ($s['mime'] == 'image/jpeg') {
$img = imagecreatefromjpeg($path);
} elseif ($s['mime'] == 'image/png') {
$img = imagecreatefrompng($path);
} elseif ($s['mime'] == 'image/gif') {
$img = imagecreatefromgif($path);
} elseif ($s['mime'] == 'image/xbm') {
$img = imagecreatefromxbm($path);
}
$degree = 360 - $degree;
list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
$bgcolor = imagecolorallocate($img, $r, $g, $b);
$tmp = imageRotate($img, $degree, (int) $bgcolor);
if ($destformat == 'jpg' || $destformat == null && $s['mime'] == 'image/jpeg') {
$result = imagejpeg($tmp, $path, 100);
} else {
if ($destformat == 'gif' || $destformat == null && $s['mime'] == 'image/gif') {
$result = imagegif($tmp, $path, 7);
} else {
$result = imagepng($tmp, $path, 7);
}
}
imageDestroy($img);
imageDestroy($tmp);
return $result ? $path : false;
break;
}
return false;
}
开发者ID:serhatozles,项目名称:yii2-elfinder,代码行数:58,代码来源:elFinderVolumeDriver.class.php
示例18: move_uploaded_file
if (preg_match('{image/(.*)}is', $size['mime'], $p)) {
// генерируем имя для изображения
$letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$image_name = '';
for ($i = 0; $i < 5; $i++) {
$image_name .= $letters[mt_rand(0, 61)];
}
// не нравится мне расширение jpeg, пусть будет jpg
if ($p[1] == 'jpeg') {
$p[1] = 'jpg';
}
// полное имя файла изображения
$image = './images/' . $image_name . '.' . $p[1];
move_uploaded_file($tmp_image_name, $image);
// Создаем новый объект imagick
$im = new imagick($image);
if ($p[1] != 'gif') {
// Открываем watermark
$watermark = new imagick('./img/watermark.png');
// узнаем размеры оригинального изображения
$im_width = $im->getImageWidth();
$im_height = $im->getImageHeight();
// узнаем размеры водяного знака
$watermark_width = $watermark->getImageWidth();
$watermark_height = $watermark->getImageHeight();
// посчитать x и y
$left = $im_width - $watermark_width - 10;
$top = $im_height - $watermark_height - 10;
// накладываем watermark на оригинальное изображение
$im->compositeImage($watermark, imagick::COMPOSITE_OVER, $left, $top);
// сохраняем оригинал
开发者ID:iSkript,项目名称:Imgur-clone,代码行数:31,代码来源:upload.php
示例19: imgRotate
/**
* Rotate image
*
* @param string $path image file
* @param int $degree rotete degrees
* @param string $bgcolor square background color in #rrggbb format
* @param string $destformat image destination format
* @return string|false
* @author nao-pon
* @author Troex Nevelin
**/
protected function imgRotate($path, $degree, $bgcolor = '#ffffff', $destformat = null)
{
if (($s = @getimagesize($path)) == false || $degree % 360 === 0) {
return false;
}
$result = false;
// try lossless rotate
if ($degree % 90 === 0 && in_array($s[2], array(IMAGETYPE_JPEG, IMAGETYPE_JPEG2000))) {
$count = $degree / 90 % 4;
$exiftran = array(1 => '-9', 2 => '-1', 3 => '-2');
$jpegtran = array(1 => '90', 2 => '180', 3 => '270');
$quotedPath = escapeshellarg($path);
$cmds = array('exiftran -i ' . $exiftran[$count] . ' ' . $path, 'jpegtran -rotate ' . $jpegtran[$count] . ' -copy all -outfile ' . $quotedPath . ' ' . $quotedPath);
foreach ($cmds as $cmd) {
if ($this->procExec($cmd) === 0) {
$result = true;
break;
}
}
if ($result) {
return $path;
}
}
switch ($this->imgLib) {
case 'imagick':
try {
$img = new imagick($path);
} catch (Exception $e) {
return false;
}
if ($img->getNumberImages() > 1) {
$img = $img->coalesceImages();
do {
$img->rotateImage(new ImagickPixel($bgcolor), $degree);
} while ($img->nextImage());
$img = $img->optimizeImageLayers();
$result = $img->writeImages($path, true);
} else {
$img->rotateImage(new ImagickPixel($bgcolor), $degree);
$result = $img->writeImage($path);
}
$img->destroy();
return $result ? $path : false;
break;
case 'gd':
$img = self::gdImageCreate($path, $s['mime']);
$degree = 360 - $degree;
list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
$bgcolor = imagecolorallocate($img, $r, $g, $b);
$tmp = imageRotate($img, $degree, (int) $bgcolor);
$result = self::gdImage($tmp, $path, $destformat, $s['mime']);
imageDestroy($img);
imageDestroy($tmp);
return $result ? $path : false;
break;
}
return false;
}
开发者ID:radumargina,项目名称:webstyle-antcr,代码行数:69,代码来源:elFinderVolumeDriver.class.php
示例20: createTmb
protected function createTmb($vd6fe1d0be6347b8ef2427fa629c04485)
{
$vd02a169f33469c888396a24dd9d9f1c6 = $this->mimetype($vd6fe1d0be6347b8ef2427fa629c04485);
if (!$this->canCreateTmb($vd6fe1d0be6347b8ef2427fa629c04485, $vd02a169f33469c888396a24dd9d9f1c6)) {
return false;
}
$vb068931cc450442b63f5b3d276ea4297 = $this->tmbName($vd6fe1d0be6347b8ef2427fa629c04485);
$va8b687c2e93191d90a6d7b8982ceec4a = $this->tmbPath . DIRECTORY_SEPARATOR . $vb068931cc450442b63f5b3d276ea4297;
if (($v25d902c24283ab8cfbac54dfa101ad31 = $this->_fopen($vd6fe1d0be6347b8ef2427fa629c04485, 'rb')) == false || ($v90710761341352a9e144d8ad4c92598b = @fopen($va8b687c2e93191d90a6d7b8982ceec4a, 'wb')) == false) {
return false;
}
while (!feof($v25d902c24283ab8cfbac54dfa101ad31)) {
fwrite($v90710761341352a9e144d8ad4c92598b, fread($v25d902c24283ab8cfbac54dfa101ad31, 8192));
}
$this->_fclose($v25d902c24283ab8cfbac54dfa101ad31, $vd6fe1d0be6347b8ef2427fa629c04485);
fclose($v90710761341352a9e144d8ad4c92598b);
if (($v03c7c0ace395d80182db07ae2c30f034 = @getimagesize($va8b687c2e93191d90a6d7b8982ceec4a)) == false) {
return false;
}
$result = false;
$v88029fd68f54ae31758f44d7b965868f = $this->tmbSize;
list($v9dd4e461268c8034f5c8564e155c67a6, $v415290769594460e2e485922904f345d, $v84b16781293d33e80d74ef9d63280bc0, $v55fc30b57cc1b80e8f68104931fbf716) = $this->tmbEffects($v03c7c0ace395d80182db07ae2c30f034[0], $v03c7c0ace395d80182db07ae2c30f034[1], $v88029fd68f54ae31758f44d7b965868f, $this->options['tmbCrop']);
switch ($this->imgLib) {
case 'imagick':
try {
$vb798abe6e1b1318ee36b0dcb3fb9e4d3 = new imagick($va8b687c2e93191d90a6d7b8982ceec4a);
} catch (Exception $ve1671797c52e15f763380b45e841ec32) {
return false;
}
$vb798abe6e1b1318ee36b0dcb3fb9e4d3->contrastImage(1);
if ($this->options['tmbCrop'] == false) {
$va8a63b4d63a08aed720d0f5f249e07d9 = new Imagick();
$va8a63b4d63a08aed720d0f5f249e07d9->newImage($v88029fd68f54ae31758f44d7b965868f, $v88029fd68f54ae31758f44d7b965868f, new ImagickPixel($this->options['tmbBgColor']));
$va8a63b4d63a08aed720d0f5f249e07d9->setImageFormat('png');
$vb798abe6e1b1318ee36b0dcb3fb9e4d3->resizeImage($v84b16781293d33e80d74ef9d63280bc0, $v55fc30b57cc1b80e8f68104931fbf716, NULL, true);
$va8a63b4d63a08aed720d0f5f249e07d9->compositeImage($vb798abe6e1b1318ee36b0dcb3fb9e4d3, imagick::COMPOSITE_OVER, $v9dd4e461268c8034f5c8564e155c67a6, $v415290769594460e2e485922904f345d);
$result = $va8a63b4d63a08aed720d0f5f249e07d9->writeImage($va8b687c2e93191d90a6d7b8982ceec4a);
} else {
$result = $vb798abe6e1b1318ee36b0dcb3fb9e4d3->cropThumbnailImage($v88029fd68f54ae31758f44d7b965868f, $v88029fd68f54ae31758f44d7b965868f) && $vb798abe6e1b1318ee36b0dcb3fb9e4d3->writeImage($va8b687c2e93191d90a6d7b8982ceec4a);
}
break;
case 'gd':
if ($v03c7c0ace395d80182db07ae2c30f034['mime'] == 'image/jpeg') {
$vb798abe6e1b1318ee36b0dcb3fb9e4d3 = imagecreatefromjpeg($va8b687c2e93191d90a6d7b8982ceec4a);
} elseif ($v03c7c0ace395d80182db07ae2c30f034['mime'] == 'image/png') {
$vb798abe6e1b1318ee36b0dcb3fb9e4d3 = imagecreatefrompng($va8b687c2e93191d90a6d7b8982ceec4a);
} elseif ($v03c7c0ace395d80182db07ae2c30f034['mime'] == 'image/gif') {
$vb798abe6e1b1318ee36b0dcb3fb9e4d3 = imagecreatefromgif($va8b687c2e93191d90a6d7b8982ceec4a);
} elseif ($v03c7c0ace395d80182db07ae2c30f034['mime'] == 'image/xbm') {
$vb798abe6e1b1318ee36b0dcb3fb9e4d3 = imagecreatefromxbm($va8b687c2e93191d90a6d7b8982ceec4a);
}
if (isset($vb798abe6e1b1318ee36b0dcb3fb9e4d3) && $vb798abe6e1b1318ee36b0dcb3fb9e4d3 && false != ($vfa816edb83e95bf0c8da580bdfd491ef = imagecreatetruecolor($v88029fd68f54ae31758f44d7b965868f, $v88029fd68f54ae31758f44d7b965868f))) {
if ($this->options['tmbCrop'] == false) {
if ($this->options['tmbBgColor'] == 'transparent') {
list($v4b43b0aee35624cd95b910189b3dc231, $vb2f5ff47436671b6e533d8dc3614845d, $v92eb5ffee6ae2fec3ad71c777531578f) = array(0, 0, 255);
} else {
list($v4b43b0aee35624cd95b910189b3dc231, $vb2f5ff47436671b6e533d8dc3614845d, $v92eb5ffee6ae2fec3ad71c777531578f) = sscanf($this->options['tmbBgColor'], "#%02x%02x%02x");
}
$ve12224dadfacf7a79886df59f202a403 = imagecolorallocate($vfa816edb83e95bf0c8da580bdfd491ef, $v4b43b0aee35624cd95b910189b3dc231, $vb2f5ff47436671b6e533d8dc3614845d, $v92eb5ffee6ae2fec3ad71c777531578f);
if ($this->options['tmbBgColor'] == 'transparent') {
$ve12224dadfacf7a79886df59f202a403 = imagecolortransparent($vfa816edb83e95bf0c8da580bdfd491ef, $ve12224dadfacf7a79886df59f202a403);
}
imagefill($vfa816edb83e95bf0c8da580bdfd491ef, 0, 0, $ve12224dadfacf7a79886df59f202a403);
if (!imagecopyresampled($vfa816edb83e95bf0c8da580bdfd491ef, $vb798abe6e1b1318ee36b0dcb3fb9e4d3, $v9dd4e461268c8034f5c8564e155c67a6, $v415290769594460e2e485922904f345d, 0, 0, $v84b16781293d33e80d74ef9d63280bc0, $v55fc30b57cc1b80e8f68104931fbf716, $v03c7c0ace395d80182db07ae2c30f034[0], $v03c7c0ace395d80182db07ae2c30f034[1])) {
return false;
}
} else {
if (!imagecopyresampled($vfa816edb83e95bf0c8da580bdfd491ef, $vb798abe6e1b1318ee36b0dcb3fb9e4d3, 0, 0, $v9dd4e461268c8034f5c8564e155c67a6, $v415290769594460e2e485922904f345d, $v88029fd68f54ae31758f44d7b965868f, $v88029fd68f54ae31758f44d7b965868f, $v84b16781293d33e80d74ef9d63280bc0, $v55fc30b57cc1b80e8f68104931fbf716)) {
return false;
}
}
$result = imagepng($vfa816edb83e95bf0c8da580bdfd491ef, $va8b687c2e93191d90a6d7b8982ceec4a, 7);
imagedestroy($vb798abe6e1b1318ee36b0dcb3fb9e4d3);
imagedestroy($vfa816edb83e95bf0c8da580bdfd491ef);
}
break;
}
return $result ? $vb068931cc450442b63f5b3d276ea4297 : false;
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:79,代码来源:elFinderVolumeDriver.class.php
注:本文中的imagick类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论