当前位置: 首页>>代码示例>>PHP>>正文


PHP imagick::destroy方法代码示例

本文整理汇总了PHP中imagick::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP imagick::destroy方法的具体用法?PHP imagick::destroy怎么用?PHP imagick::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在imagick的用法示例。


在下文中一共展示了imagick::destroy方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mkdir

 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: 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);
             $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:mechiko,项目名称:staff-october,代码行数:43,代码来源:elFinderVolumeDriver.class.php

示例3: resize_imagick

 private function resize_imagick($src, $width, $height, $quality, $preserveExif)
 {
     try {
         $img = new imagick($src);
         if (strtoupper($img->getImageFormat()) === 'JPEG') {
             $img->setImageCompression(imagick::COMPRESSION_JPEG);
             $img->setImageCompressionQuality($quality);
             if (!$preserveExif) {
                 try {
                     $orientation = $img->getImageOrientation();
                 } catch (ImagickException $e) {
                     $orientation = 0;
                 }
                 $img->stripImage();
                 if ($orientation) {
                     $img->setImageOrientation($orientation);
                 }
             }
         }
         $img->resizeImage($width, $height, Imagick::FILTER_LANCZOS, true);
         $result = $img->writeImage($src);
         $img->clear();
         $img->destroy();
         return $result ? true : false;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:idea-lab,项目名称:Spectrum,代码行数:28,代码来源:plugin.php

示例4: foreach

            }
            @unlink($tmpfile);
        }
    }
    // Print the output
    foreach ($image_list as $img) {
        if ($img['thumb'] != '') {
            $url = $img['url'];
            $title = $img['title'];
            $thumb = $img['thumb'];
            $subreddit = $img['subreddit'];
            $permalink = "http://reddit.com/" . $img['permalink'];
            $img = new imagick($thumb);
            $height = $img->getImageHeight();
            $img->clear();
            $img->destroy();
            $thumb = '/' . $thumb;
            $subreddit_text = '';
            if ($bSubreddit) {
                $subreddit_text = '<a class="cat" href="http://redditporn.com/r/' . $subreddit . '" style="color: #3BB9FF">' . $subreddit . '</a><br/>';
            }
            echo '<li id="mosaic1170" class="item_image" style="height: ' . ($height + 4) . 'px;">
				<div class="img">
					<a href="' . $url . '" target="_blank"><img src="' . $thumb . '" alt="' . $title . '" width="300" height="' . $height . '"/></a>
				</div>
				<div class="info">
					' . $subreddit_text . '
					<a href="' . $permalink . '" target="_blank">' . $title . '</a>
				</div>
				</li>';
        }
开发者ID:ReillyKlevre,项目名称:redditporn,代码行数:31,代码来源:index.php

示例5: _resizeImagick

 public function _resizeImagick(Model $model, $field, $path, $size, $geometry, $thumbnailPath)
 {
     $srcFile = $path . $model->data[$model->alias][$field];
     $pathInfo = $this->_pathinfo($srcFile);
     $thumbnailType = $imageFormat = $this->settings[$model->alias][$field]['thumbnailType'];
     $isMedia = $this->_isMedia($model, $this->runtime[$model->alias][$field]['type']);
     $image = new imagick();
     if ($isMedia) {
         $image->setResolution(300, 300);
         $srcFile = $srcFile . '[0]';
     }
     $image->readImage($srcFile);
     $height = $image->getImageHeight();
     $width = $image->getImageWidth();
     if (preg_match('/^\\[[\\d]+x[\\d]+\\]$/', $geometry)) {
         // resize with banding
         list($destW, $destH) = explode('x', substr($geometry, 1, strlen($geometry) - 2));
         $image->thumbnailImage($destW, $destH, true);
         $imageGeometry = $image->getImageGeometry();
         $x = ($imageGeometry['width'] - $destW) / 2;
         $y = ($imageGeometry['height'] - $destH) / 2;
         $image->setGravity(Imagick::GRAVITY_CENTER);
         $image->extentImage($destW, $destH, $x, $y);
     } elseif (preg_match('/^[\\d]+x[\\d]+$/', $geometry)) {
         // cropped resize (best fit)
         list($destW, $destH) = explode('x', $geometry);
         $image->cropThumbnailImage($destW, $destH);
     } elseif (preg_match('/^[\\d]+w$/', $geometry)) {
         // calculate heigh according to aspect ratio
         $image->thumbnailImage((int) $geometry - 1, 0);
     } elseif (preg_match('/^[\\d]+h$/', $geometry)) {
         // calculate width according to aspect ratio
         $image->thumbnailImage(0, (int) $geometry - 1);
     } elseif (preg_match('/^[\\d]+l$/', $geometry)) {
         // calculate shortest side according to aspect ratio
         $destW = 0;
         $destH = 0;
         $destW = $width > $height ? (int) $geometry - 1 : 0;
         $destH = $width > $height ? 0 : (int) $geometry - 1;
         $imagickVersion = phpversion('imagick');
         $image->thumbnailImage($destW, $destH, !($imagickVersion[0] == 3));
     }
     if ($isMedia) {
         $thumbnailType = $imageFormat = $this->settings[$model->alias][$field]['mediaThumbnailType'];
     }
     if (!$thumbnailType || !is_string($thumbnailType)) {
         try {
             $thumbnailType = $imageFormat = $image->getImageFormat();
             // Fix file casing
             while (true) {
                 $ext = false;
                 $pieces = explode('.', $srcFile);
                 if (count($pieces) > 1) {
                     $ext = end($pieces);
                 }
                 if (!$ext || !strlen($ext)) {
                     break;
                 }
                 $low = array('ext' => strtolower($ext), 'thumbnailType' => strtolower($thumbnailType));
                 if ($low['ext'] == 'jpg' && $low['thumbnailType'] == 'jpeg') {
                     $thumbnailType = $ext;
                     break;
                 }
                 if ($low['ext'] == $low['thumbnailType']) {
                     $thumbnailType = $ext;
                 }
                 break;
             }
         } catch (Exception $e) {
             $this->log($e->getMessage(), 'upload');
             $thumbnailType = $imageFormat = 'png';
         }
     }
     $fileName = str_replace(array('{size}', '{filename}', '{primaryKey}'), array($size, $pathInfo['filename'], $model->id), $this->settings[$model->alias][$field]['thumbnailName']);
     $destFile = "{$thumbnailPath}{$fileName}.{$thumbnailType}";
     $image->setImageCompressionQuality($this->settings[$model->alias][$field]['thumbnailQuality']);
     $image->setImageFormat($imageFormat);
     if (!$image->writeImage($destFile)) {
         return false;
     }
     $image->clear();
     $image->destroy();
     return true;
 }
开发者ID:ederdsr,项目名称:civisindicadores,代码行数:84,代码来源:UploadBehavior.php

示例6: imagick

 function _resizeImagick(&$model, $field, $path, $size, $geometry, $thumbnailPath)
 {
     $srcFile = $path . $model->data[$model->alias][$field];
     $pathInfo = $this->_pathinfo($srcFile);
     $thumbnailType = $this->settings[$model->alias][$field]['thumbnailType'];
     $isMedia = $this->_isMedia($model, $this->runtime[$model->alias][$field]['type']);
     $image = new imagick();
     if ($isMedia) {
         $image->setResolution(300, 300);
         $srcFile = $srcFile . '[0]';
     }
     $image->readImage($srcFile);
     $height = $image->getImageHeight();
     $width = $image->getImageWidth();
     if (preg_match('/^\\[[\\d]+x[\\d]+\\]$/', $geometry)) {
         // resize with banding
         list($destW, $destH) = explode('x', substr($geometry, 1, strlen($geometry) - 2));
         $image->thumbnailImage($destW, $destH);
     } elseif (preg_match('/^[\\d]+x[\\d]+$/', $geometry)) {
         // cropped resize (best fit)
         list($destW, $destH) = explode('x', $geometry);
         $image->cropThumbnailImage($destW, $destH);
     } elseif (preg_match('/^[\\d]+w$/', $geometry)) {
         // calculate heigh according to aspect ratio
         $image->thumbnailImage((int) $geometry - 1, 0);
     } elseif (preg_match('/^[\\d]+h$/', $geometry)) {
         // calculate width according to aspect ratio
         $image->thumbnailImage(0, (int) $geometry - 1);
     } elseif (preg_match('/^[\\d]+l$/', $geometry)) {
         // calculate shortest side according to aspect ratio
         $destW = 0;
         $destH = 0;
         $destW = $width > $height ? (int) $geometry - 1 : 0;
         $destH = $width > $height ? 0 : (int) $geometry - 1;
         $imagickVersion = phpversion('imagick');
         $image->thumbnailImage($destW, $destH, !($imagickVersion[0] == 3));
     }
     if ($isMedia) {
         $thumbnailType = $this->settings[$model->alias][$field]['mediaThumbnailType'];
     }
     if (!$thumbnailType || !is_string($thumbnailType)) {
         try {
             $thumbnailType = $image->getImageFormat();
         } catch (Exception $e) {
             $thumbnailType = 'png';
         }
     }
     $fileName = str_replace(array('{size}', '{filename}'), array($size, $pathInfo['filename']), $this->settings[$model->alias][$field]['thumbnailName']);
     $destFile = "{$thumbnailPath}{$fileName}.{$thumbnailType}";
     $image->setImageCompressionQuality($this->settings[$model->alias][$field]['thumbnailQuality']);
     $image->setImageFormat($thumbnailType);
     if (!$image->writeImage($destFile)) {
         return false;
     }
     $image->clear();
     $image->destroy();
     return true;
 }
开发者ID:ryantology,项目名称:upload,代码行数:58,代码来源:upload.php

示例7: 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;
             }
             $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:Alex-Bond,项目名称:yii2-elfinder,代码行数:60,代码来源:elFinderVolumeDriver.class.php

示例8: 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

示例9: resizeCropImg

 private function resizeCropImg($pFolder, $pImg, $pW, $pH)
 {
     $im = new imagick();
     $im->readImage($pFolder . $pImg);
     $image = new stdClass();
     $image->dimensions = $im->getImageGeometry();
     $image->w = $image->dimensions['width'];
     $image->h = $image->dimensions['height'];
     $image->ratio = $image->w / $image->h;
     if ($image->w / $pW < $image->h / $pH) {
         $h = ceil($pH * $image->w / $pW);
         $y = ($image->h - $pH * $image->w / $pW) / 2;
         $im->cropImage($image->w, $h, 0, $y);
     } else {
         $w = ceil($pW * $image->h / $pH);
         $x = ($image->w - $pW * $image->h / $pH) / 2;
         $im->cropImage($w, $image->h, $x, 0);
     }
     $im->ThumbnailImage($pW, $pH, true);
     if ($img->type === "PNG") {
         $im->setImageCompressionQuality(55);
         $im->setImageFormat('png');
     } elseif ($img->type === "JPG" || $img->type === "JPEG") {
         $im->setCompressionQuality(100);
         $im->setImageFormat("jpg");
     }
     $im->writeImage($this->ad->url->folder . '/assets/' . $pImg);
     $im->destroy();
 }
开发者ID:arnolali,项目名称:incontournables-du-voyage,代码行数:29,代码来源:Ad.php

示例10: getPdfFromImages

 /**
  * Generate pdf, preview pdf from images uploaded by user.
  *
  * @param array $images
  *
  * @return array
  *
  * @author Kuldeep Dangi <kuldeep.dangi@yiifrmae.com>
  */
 public function getPdfFromImages($images)
 {
     $fileUploadAbsolutePath = Yii::app()->params['FILE_SERVER_IMAGE_PATH'] . self::FILE_UPLOAD_PATH;
     $pdfUploadAbsolutePath = Yii::app()->params['FILE_SERVER_IMAGE_PATH'] . self::FILE_CONVERT_PATH;
     $upload_file = array();
     $html = $previewHtml = '';
     $randomNumber = MD5($this->getRandomNumber());
     $savedFileNames = array('image' => $randomNumber . '.jpg', 'imagepdf' => $randomNumber . '.pdf.pdf', 'pdf' => $randomNumber . '.pdf');
     $imagesCount = count($images);
     $imageCounterCount = 1;
     foreach ($images as $image) {
         if ($imagesCount > 3 && $imageCounterCount < 4) {
             $previewHtml .= '<img src="../' . self::FILE_UPLOAD_PATH . $image . '"/>';
         } elseif ($imagesCount < 4 && $imageCounterCount == $imagesCount) {
             $previewHtml .= '<img src="../' . self::FILE_UPLOAD_PATH . $image . '"/>';
         }
         $html .= '<img src="../' . self::FILE_UPLOAD_PATH . $image . '"/>';
         $imageCounterCount++;
     }
     $mpdf = Yii::app()->ePdf->mpdf();
     $mpdf->debug = true;
     $mpdf->WriteHTML($html);
     $mpdf->Output('../' . self::FILE_CONVERT_PATH . $savedFileNames['pdf'], 'F');
     $mpdf1 = Yii::app()->ePdf->mpdf();
     $mpdf1->debug = true;
     $mpdf1->WriteHTML($previewHtml);
     $mpdf1->Output('../' . self::FILE_PDF_PREVIEW_PATH . $savedFileNames['imagepdf'], 'F');
     $im = new imagick();
     $im->readimage('/home/notesgen/public_html/' . self::FILE_PDF_PREVIEW_PATH . $savedFileNames['imagepdf']);
     $im->setImageCompressionQuality(0);
     $im->setImageFormat('jpeg');
     $im->writeImage('../' . self::FILE_IMAGE_PATH . $savedFileNames['image']);
     $im->setImageCompressionQuality(80);
     $im->writeImage('../' . self::FILE_IMAGE_PATH_APP . $savedFileNames['image']);
     $im->clear();
     $im->destroy();
     return $savedFileNames;
 }
开发者ID:kuldeepro,项目名称:notesgen,代码行数:47,代码来源:Extensions.php

示例11: system

            }
        }
        //根据生成图片的大小调用语句
        $wbshell = $picsize == 1 ? $wbshell1 : $wbshell2;
        //执行截图语句
        system($wbshell);
        //exec($wbshell);
        //注:下面的操作仅是对图片进一步进行调整,可以缩小图片体积等,并方便更多的处理,并非必须。
        $im = new imagick($img_name);
        //if($picsize==1) $im->resizeImage(490,0,Imagick::FILTER_LANCZOS,1);
        $im->setImageFormat("png");
        $im->setCompressionQuality(90);
        $img_name2 = 'html2png/' . time() . '.png';
        $im->writeImage($img_name2);
        $im->clear();
        $im->destroy();
        //输出图片连接
        $url_this = dirname('http://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]) . '/' . $img_name2;
    } else {
        $url_this = dirname('http://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]) . '/google.png';
    }
    ?>
<div class="wrapper" >
<h1>内容生成工具</h1>
<ul>
    <li><?php 
    echo $errinfo;
    ?>
</li>
    <li>查看该图片地址:<a href="<?php 
    echo $url_this;
开发者ID:boxcore,项目名称:ChangWeiBo,代码行数:31,代码来源:result.php

示例12: uploadfile


//.........这里部分代码省略.........
         $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();
                 $im->destroy();
                 echo $path_upload . '|' . serialize($data) . '|upload_file/images/r' . $md5 . '.jpg|upload_file/files/' . $uploaddatafile1 . '.pdf';
                 //  echo $path_upload.'|'.serialize($data).'|upload_file/images/'.$md5.'.jpg |upload_file/files/'.$md5.'.pdf';
                 //echo $path_upload.'|'.serialize($data).'|upload_file/files/cc'.$md5.'.pdf|upload_file/files/'.$md5.'.pdf';
                 //echo $path_upload.'|'.serialize($data).'|upload_file/images/'.$md5.'.jpg |upload_file/files/'.$_FILES["Filedata"]["name"].'.pdf';
                 //echo $path_upload.'|'.serialize($data).'|upload_file/images/img'.$md5.'.jpg';
                 //	$_SESSION['scriptfile']=	('/upload_file/files/r'.$uploaddatafile1.".pdf");
                 //echo $path_upload.'|upload_file/files/c'.$filedata.'.pdf';
                 //$_SESSION['imagedata']=	('upload_file/images/img'.$md5.'.jpg');
             } else {
                 echo "1";
             }
         } else {
             echo "1";
         }
     }
 }
开发者ID:kuldeepro,项目名称:notesgen,代码行数:101,代码来源:pages.php

示例13: resize

 public static function resize($orig_file_path, $settings, $target_file_path)
 {
     $quality = 95;
     $crop = $settings['crop_method'];
     $current_width = $settings['width'];
     $current_height = $settings['height'];
     $target_width = min($current_width, $settings['width_requested']);
     $target_height = min($current_height, $settings['height_requested']);
     if ($crop) {
         $x_ratio = $target_width / $current_width;
         $y_ratio = $target_height / $current_height;
         $ratio = min($x_ratio, $y_ratio);
         $use_x_ratio = $x_ratio == $ratio;
         $new_width = $use_x_ratio ? $target_width : floor($current_width * $ratio);
         $new_height = !$use_x_ratio ? $target_height : floor($current_height * $ratio);
     } else {
         $new_width = $target_width;
         $new_height = $target_height;
     }
     $im = new imagick($orig_file_path);
     $im->cropThumbnailImage($new_width, $new_height);
     $im->setImageCompression(imagick::COMPRESSION_JPEG);
     $im->setImageCompressionQuality($quality);
     $im->stripImage();
     $result = $im->writeImage($target_file_path);
     $im->destroy();
     return array($new_width, $new_height, $target_width, $target_height);
 }
开发者ID:rasstroen,项目名称:baby-album,代码行数:28,代码来源:ImgStore.php


注:本文中的imagick::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。