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


PHP NewMagickWand函数代码示例

本文整理汇总了PHP中NewMagickWand函数的典型用法代码示例。如果您正苦于以下问题:PHP NewMagickWand函数的具体用法?PHP NewMagickWand怎么用?PHP NewMagickWand使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: makeGifFromZip

 public static function makeGifFromZip($zip_file_path, $delay)
 {
     $dir = $zip_file_path . 'dir/';
     $zip = new ZipArchive();
     $res = $zip->open($zip_file_path);
     if ($res === TRUE) {
         $zip->extractTo($dir);
         $zip->close();
     }
     $files = glob($dir . '/*');
     ksort($files);
     $mw = NewMagickWand();
     for ($i = 0, $l = count($files); $i < $l; $i++) {
         $rw = NewMagickWand();
         MagickReadImage($rw, $files[$i]);
         MagickSetImageDelay($rw, intval($delay) / 10);
         //magickwand比较特殊,>用的不是毫秒,所以毫秒需要转成1/100秒
         MagickAddImage($mw, $rw);
         DestroyMagickWand($rw);
     }
     MagickSetFormat($mw, 'gif');
     $gif_file_path = $zip_file_path . '.gif';
     MagickWriteImages($mw, $gif_file_path, true);
     DestroyMagickWand($mw);
     //todo 删除目录
     return $gif_file_path;
 }
开发者ID:sinkcup,项目名称:choose-api,代码行数:27,代码来源:ImgLib.php

示例2: _getResource

 protected function _getResource()
 {
     if (isset($this->_resource)) {
         DestroyMagickWand($this->_resource);
     }
     $this->_resource = NewMagickWand();
 }
开发者ID:rdallasgray,项目名称:bbx,代码行数:7,代码来源:Magickwand.php

示例3: resize

 function resize($source_name, $width = "", $height = "", $save_name = "")
 {
     $resource = NewMagickWand();
     MagickReadImage($resource, $source_name);
     $src_image_x = MagickGetImageWidth($resource);
     $src_image_y = MagickGetImageHeight($resource);
     $src_image_scale = $src_image_x / $src_image_y;
     if ($width && $height) {
         $new_image_x = $width;
         $new_image_y = $height;
     } else {
         if ($width) {
             $new_image_x = $width;
             $new_image_y = $new_image_x * ($src_image_y / $src_image_x);
         } else {
             $new_image_y = $height;
             $new_image_x = $new_image_y * ($src_image_x / $src_image_y);
         }
     }
     MagickResizeImage($resource, $new_image_x, $new_image_y, MW_BoxFilter, 1);
     if ($save_name) {
         MagickWriteImage($resource, $save_name);
     } else {
         header('Content-Type: image/jpeg');
         MagickEchoImageBlob($resource);
     }
     DestroymagickWand($resource);
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:28,代码来源:ImageMagickUtility.class.php

示例4: prepare

 /**
  * @return Uploader
  */
 public function prepare()
 {
     if (is_array($this->session)) {
         $this->digital = (string) $this->session['digital'];
         $this->public = (bool) $this->session['fg_publico'];
     } else {
         throw new Exception('Não foi possível recuperar os dados da sessão!');
     }
     if ($this->_isFile()) {
         $this->hash = (string) hash_file('md5', $this->file["tmp_name"]);
         $this->type = (string) substr($this->file["name"], -3);
         $this->size = (int) $this->file["size"];
         try {
             MagickReadImage($object = NewMagickWand(), $this->file["tmp_name"]);
             $this->width = MagickGetImageWidth($object);
             $this->height = MagickGetImageHeight($object);
             $this->codeType = MagickGetImageFormat($object);
             $this->sizeBytes = MagickGetImageSize($object);
             $this->compression = MagickGetImageCompression($object);
             $this->compressionQuality = MagickGetImageCompressionQuality($object);
             $this->resolution = MagickGetImageResolution($object);
             $this->resolutionUnits = MagickGetImageUnits($object);
         } catch (Exception $e) {
             throw new Exception('Ocorreu um erro!');
         }
     } else {
         throw new Exception('O arquivo está ausente!');
     }
     return $this;
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:33,代码来源:Uploader.php

示例5: watermark

 public function watermark($file, $mark_image, $set)
 {
     $sourceWand = NewMagickWand();
     $compositeWand = NewMagickWand();
     MagickReadImage($compositeWand, $mark_image);
     MagickReadImage($sourceWand, $file);
     MagickSetImageIndex($compositeWand, 0);
     MagickSetImageType($compositeWand, MW_TrueColorMatteType);
     MagickEvaluateImage($compositeWand, MW_SubtractEvaluateOperator, ($set['wm_opacity'] ? $set['wm_opacity'] : 50) / 100, MW_OpacityChannel);
     MagickCompositeImage($sourceWand, $compositeWand, MW_ScreenCompositeOp, $set['dest_x'], $set['dest_y']);
     MagickWriteImage($sourceWand, $file);
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:12,代码来源:magickwand.php

示例6: makeThumbnailtoFile

 function makeThumbnailtoFile($destFile)
 {
     $returnVal = false;
     if (!$this->isWorking()) {
         return false;
     }
     $image = NewMagickWand();
     MagickReadImage($image, $this->sourceFile);
     MagickSetImageCompressionQuality($image, $this->thumbQuality);
     MagickThumbnailImage($image, $this->thumbWidth, $this->thumbHeight);
     $returnVal = MagickWriteImage($image, $destFile);
     unset($image);
     return $returnVal;
 }
开发者ID:RicterZ,项目名称:pixmicat,代码行数:14,代码来源:thumb.magickwand.php

示例7: createCacheJpegView

 /**
  * @return Imagens
  * @param string $digital
  * @param string $md5
  * @param boolean $high
  * @param int $active
  * @param int $total
  */
 public function createCacheJpegView($digital, $md5, $high = false)
 {
     $iImageHeightPixel = $high === false ? 960 : 2480;
     $iImageWidthPixel = $high === false ? 1280 : 3508;
     $lote = $this->generateLote($digital);
     $dirCache = sprintf('%s/cache/%s', __CAM_UPLOAD__, $lote);
     $tiff = sprintf('%s/%s/%s/%s.tif', __CAM_UPLOAD__, $lote, $digital, $md5);
     $view = sprintf('%s/%s/%s_view_%d.jpg', $dirCache, $digital, $md5, $high === false ? self::Q_LOW : self::Q_HIGH);
     $thumbs = sprintf('%s/%s/%s_thumb.jpg', $dirCache, $digital, $md5);
     if (!is_file($tiff)) {
         throw new Exception('Arquivo TIFF original não encontrado!');
     }
     if (is_file($view)) {
         return $this;
     }
     // thumbs
     if (!is_file($thumbs)) {
         MagickReadImage($magickThumbs = NewMagickWand(), $tiff);
         if (MagickGetImageWidth($magickThumbs) < MagickGetImageHeight($magickThumbs)) {
             MagickResizeImage($magickThumbs, 150, 200, MW_QuadraticFilter, 1.0);
         } else {
             MagickResizeImage($magickThumbs, 200, 150, MW_QuadraticFilter, 1.0);
         }
         MagickSetImageFormat($magickThumbs, 'JPG');
         MagickSetImageResolution($magickThumbs, 200, 200);
         MagickSetImageUnits($magickThumbs, MW_PixelsPerInchResolution);
         MagickSetImageCompression($magickThumbs, MW_JPEGCompression);
         MagickSetImageCompressionQuality($magickThumbs, 0.0);
         MagickWriteImage($magickThumbs, $thumbs);
     }
     // views
     MagickReadImage($magickView = NewMagickWand(), $tiff);
     if (MagickGetImageWidth($magickView) > MagickGetImageHeight($magickView)) {
         MagickResizeImage($magickView, $iImageWidthPixel, $iImageHeightPixel, MW_QuadraticFilter, 1.0);
     } else {
         MagickResizeImage($magickView, $iImageHeightPixel, $iImageWidthPixel, MW_QuadraticFilter, 1.0);
     }
     MagickSetImageFormat($magickView, 'JPG');
     MagickSetImageResolution($magickView, 200, 200);
     MagickSetImageUnits($magickView, MW_PixelsPerInchResolution);
     MagickSetImageCompression($magickView, MW_JPEGCompression);
     MagickSetImageCompressionQuality($magickView, 0.0);
     MagickWriteImage($magickView, $view);
     $errorMagick = MagickGetExceptionString($magickView);
     if ($errorMagick) {
         throw new Exception($errorMagick);
     }
     return $this;
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:57,代码来源:Imagens.php

示例8: liberty_magickwand_panorama_image

/**
 * liberty_magickwand_panorama_image - strictly speaking, this belongs in one of the image processing plugin files, but we'll leave it here for the moment
 *
 * @param array $pFileHash File hash - souce_file is required
 * @param array $pOptions
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function liberty_magickwand_panorama_image(&$pFileHash, $pOptions = array())
{
    $magickWand = NewMagickWand();
    $pFileHash['error'] = NULL;
    if (!empty($pFileHash['source_file']) && is_file($pFileHash['source_file'])) {
        if (!($pFileHash['error'] = liberty_magickwand_check_error(MagickReadImage($magickWand, $pFileHash['source_file']), $magickWand))) {
            // calculate border width
            $iwidth = round(MagickGetImageWidth($magickWand));
            $iheight = round(MagickGetImageHeight($magickWand));
            $aspect = $iwidth / $iheight;
            $metaHash = array('width' => $iwidth, 'height' => $iheight, 'aspect' => $aspect);
            // store original file information that we can adjust the viewer
            LibertyMime::storeMetaData($pFileHash['attachment_id'], 'PANO', $metaHash);
            // we need to pad the image if the aspect ratio is not 2:1 (give it a wee bit of leeway that we don't add annoying borders if not really needed)
            if ($aspect > 2.1 || $aspect < 1.9) {
                $bwidth = $bheight = 0;
                if ($aspect > 2) {
                    $bheight = round(($iwidth / 2 - $iheight) / 2);
                } else {
                    $bwidth = round(($iheight / 2 - $iwidth) / 2);
                }
                // if the ratio has nothing to do with a panorama image - i.e. gives us a negative number here, we won't generate a panorama image
                if ($bheight > 0) {
                    $pixelWand = NewPixelWand();
                    PixelSetColor($pixelWand, !empty($pOptions['background']) ? $pOptions['background'] : 'black');
                    if (!($pFileHash['error'] = liberty_magickwand_check_error(MagickBorderImage($magickWand, $pixelWand, $bwidth, $bheight), $magickWand))) {
                        if (!($pFileHash['error'] = liberty_magickwand_check_error(MagickWriteImage($magickWand, $pFileHash['source_file']), $magickWand))) {
                            // yay!
                        }
                    }
                    DestroyPixelWand($pixelWand);
                }
            }
        }
    }
    DestroyMagickWand($magickWand);
    return empty($pFileHash['error']);
}
开发者ID:kailIII,项目名称:liberty,代码行数:46,代码来源:mime.image.php

示例9: liberty_magickwand_convert_colorspace_image

/**
 * liberty_magickwand_convert_colorspace
 * 
 * @param array $pFileHash
 * @param string $pColorSpace - target color space, only 'grayscale' is currently supported
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function liberty_magickwand_convert_colorspace_image(&$pFileHash, $pColorSpace)
{
    $ret = FALSE;
    if (!empty($pFileHash['source_file']) && is_file($pFileHash['source_file'])) {
        $magickWand = NewMagickWand();
        if ($error = liberty_magickwand_check_error(MagickReadImage($magickWand, $pFileHash['source_file']), $magickWand)) {
            bit_error_log("MagickReadImage Failed:{$error} ( {$pFileHash['source_file']} )");
        } else {
            MagickRemoveImageProfile($magickWand, "ICC");
            switch (strtolower($pColorSpace)) {
                case 'grayscale':
                    if (MagickGetImageColorspace($magickWand) == MW_GRAYColorspace) {
                        $ret = TRUE;
                    } else {
                        MagickSetImageColorspace($magickWand, MW_GRAYColorspace);
                        if (empty($pFileHash['dest_file'])) {
                            $pFileHash['dest_file'] = STORAGE_PKG_PATH . $pFileHash['dest_branch'] . $pFileHash['name'];
                        }
                        if ($error = liberty_magickwand_check_error(MagickWriteImage($magickWand, $pFileHash['dest_file']), $magickWand)) {
                            bit_error_log("MagickWriteImage Failed:{$error} ( {$pFileHash['source_file']} )");
                        } else {
                            $ret = TRUE;
                        }
                    }
                    break;
            }
        }
        DestroyMagickWand($magickWand);
    }
    return $ret;
}
开发者ID:kailIII,项目名称:liberty,代码行数:39,代码来源:processor.magickwand.php

示例10: PosterizeNew

 function PosterizeNew()
 {
     $MagickWand = NewMagickWand();
     MagickReadImage($MagickWand, "/home/alex/src/imws-server/app/www/turtlz.jpg");
     #$e = MagickGetExceptionString($MagickWand);
     #die($e);
     MagickSetImageFormat($MagickWand, 'png');
     MagickWriteImage($MagickWand, "/tmp/zz");
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:9,代码来源:class.PhotoFilter.php

示例11: liberty_generate_thumbnails

/**
 * liberty_generate_thumbnails
 *
 * @param array $pFileHash
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function liberty_generate_thumbnails($pFileHash)
{
    global $gBitSystem, $gThumbSizes;
    $resizeFunc = liberty_get_function('resize');
    $ret = FALSE;
    // allow custom selection of thumbnail sizes
    if (empty($pFileHash['thumbnail_sizes'])) {
        if (!empty($gThumbSizes) && is_array($gThumbSizes)) {
            $pFileHash['thumbnail_sizes'] = array_keys($gThumbSizes);
        } else {
            $pFileHash['thumbnail_sizes'] = array('large', 'medium', 'small', 'avatar', 'icon');
        }
    }
    if (!preg_match('#image/(gif|jpe?g|png)#i', $pFileHash['type']) && $gBitSystem->isFeatureActive('liberty_jpeg_originals') || in_array('original', $pFileHash['thumbnail_sizes'])) {
        // jpeg version of original
        if (preg_match('/pdf/i', $pFileHash['type'])) {
            // has a customer pdf rasterization function been defined?
            if (function_exists('liberty_rasterize_pdf') && ($rasteredFile = liberty_rasterize_pdf($pFileHash['source_file']))) {
                $pFileHash['source_file'] = $rasteredFile;
            } else {
                $magickWand = NewMagickWand();
                if (!($pFileHash['error'] = liberty_magickwand_check_error(MagickReadImage($magickWand, $pFileHash['source_file']), $magickWand))) {
                    MagickSetFormat($magickWand, 'JPG');
                    if (MagickGetImageColorspace($magickWand) == MW_CMYKColorspace) {
                        MagickProfileImage($magickWand, "ICC", UTIL_PKG_PATH . 'icc/srgb.icm');
                        MagickSetImageColorspace($magickWand, MW_sRGBColorspace);
                    }
                    $imgWidth = MagickGetImageWidth($magickWand);
                    $imgHeight = MagickGetImageHeight($magickWand);
                    MagickSetImageUnits($magickWand, MW_PixelsPerInchResolution);
                    MagickSetResolution($magickWand, 300, 300);
                    $rasteredFile = dirname($pFileHash['source_file']) . '/original.jpg';
                    if (!($pFileHash['error'] = liberty_magickwand_check_error(MagickWriteImage($magickWand, $rasteredFile), $magickWand))) {
                        $pFileHash['source_file'] = $rasteredFile;
                    }
                }
            }
        } else {
            $pFileHash['dest_base_name'] = 'original';
            $pFileHash['name'] = 'original.jpg';
            $pFileHash['max_width'] = MAX_THUMBNAIL_DIMENSION;
            $pFileHash['max_height'] = MAX_THUMBNAIL_DIMENSION;
            if ($convertedFile = $resizeFunc($pFileHash)) {
                $pFileHash['source_file'] = $convertedFile;
                $ret = TRUE;
            }
        }
        $pFileHash['type'] = $gBitSystem->verifyMimeType($pFileHash['source_file']);
    }
    // override $mimeExt if we have a custom setting for it
    if ($gBitSystem->isFeatureActive('liberty_thumbnail_format')) {
        $mimeExt = $gBitSystem->getConfig('liberty_thumbnail_format');
    } else {
        list($type, $mimeExt) = preg_split('#/#', strtolower($pFileHash['type']));
    }
    if (preg_match("!(png|gif)!", $mimeExt)) {
        $destExt = '.' . $mimeExt;
    } else {
        $destExt = '.jpg';
    }
    $initialDestPath = $pFileHash['dest_branch'];
    foreach ($pFileHash['thumbnail_sizes'] as $thumbSize) {
        if (isset($gThumbSizes[$thumbSize])) {
            $pFileHash['dest_base_name'] = $thumbSize;
            $pFileHash['name'] = $thumbSize . $destExt;
            if (!empty($gThumbSizes[$thumbSize]['width'])) {
                $pFileHash['max_width'] = $gThumbSizes[$thumbSize]['width'];
            } else {
                // Have to unset since we reuse $pFileHash
                unset($pFileHash['max_width']);
            }
            // reset dest_branch for created thumbs
            if (!empty($pFileHash['thumb_path'])) {
                $pFileHash['dest_file'] = $pFileHash['thumb_path'] . $pFileHash['name'];
            } else {
                // create a subdirectory for the thumbs
                $pFileHash['dest_branch'] = $initialDestPath . 'thumbs/';
                clearstatcache();
                if (!is_dir(STORAGE_PKG_PATH . $pFileHash['dest_branch'])) {
                    mkdir(STORAGE_PKG_PATH . $pFileHash['dest_branch'], 0775, TRUE);
                    clearstatcache();
                }
            }
            if (!empty($gThumbSizes[$thumbSize]['height'])) {
                $pFileHash['max_height'] = $gThumbSizes[$thumbSize]['height'];
            } else {
                // Have to unset since we reuse $pFileHash
                unset($pFileHash['max_height']);
            }
            if ($pFileHash['icon_thumb_path'] = $resizeFunc($pFileHash)) {
                $ret = TRUE;
                // use the previous thumb as the source for the next, decreasingly smaller thumb as this GREATLY increases speed
                $pFileHash['source_file'] = $pFileHash['icon_thumb_path'];
//.........这里部分代码省略.........
开发者ID:bitweaver,项目名称:liberty,代码行数:101,代码来源:liberty_lib.php

示例12: image_watermark

 /**
  * 设置图片水印
  * @param object image 实体对象
  * @param string 文件路径
  * @param array 设置的集合
  * @return null
  */
 function image_watermark(&$imgmdl, $file, $set)
 {
     switch ($set['wm_type']) {
         case 'text':
             $mark_image = $set['wm_text_image'];
             break;
         case 'image':
             $mark_image = $set['wm_image'];
             break;
         default:
             return;
     }
     if ($set['wm_text_preview']) {
         $mark_image = $set['wm_text_image'];
     } else {
         $mark_image = $imgmdl->fetch($mark_image);
     }
     list($watermark_width, $watermark_height, $type) = getimagesize($mark_image);
     list($src_width, $src_height) = getimagesize($file);
     list($dest_x, $dest_y) = self::get_watermark_dest($src_width, $src_height, $watermark_width, $watermark_height, $set['wm_loc']);
     if (ECAE_MODE) {
         include_lib('image.php');
         $obj = new ecae_image();
         $obj->set_file($file);
         $obj->watermark(file_get_contents($mark_image), $dest_x, $dest_y, 0, 0, $set['wm_opacity'] ? $set['wm_opacity'] : 50);
         $content = $obj->exec();
         if ($content) {
             file_put_contents($file, $content);
         }
     } elseif (function_exists('NewMagickWand')) {
         $sourceWand = NewMagickWand();
         $compositeWand = NewMagickWand();
         MagickReadImage($compositeWand, $mark_image);
         MagickReadImage($sourceWand, $file);
         MagickSetImageIndex($compositeWand, 0);
         MagickSetImageType($compositeWand, MW_TrueColorMatteType);
         MagickEvaluateImage($compositeWand, MW_SubtractEvaluateOperator, ($set['wm_opacity'] ? $set['wm_opacity'] : 50) / 100, MW_OpacityChannel);
         MagickCompositeImage($sourceWand, $compositeWand, MW_ScreenCompositeOp, $dest_x, $dest_y);
         MagickWriteImage($sourceWand, $file);
     } elseif (method_exists(image_clip, 'imagecreatefrom')) {
         $sourceimage = self::imagecreatefrom($file);
         $watermark = self::imagecreatefrom($mark_image);
         imagecolortransparent($watermark, imagecolorat($watermark, 0, 0));
         imagealphablending($watermark, 1);
         $set['wm_opacity'] = intval($set['wm_opacity']);
         imagecopymerge($sourceimage, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $set['wm_opacity']);
         imagejpeg($sourceimage, $file);
         imagedestroy($sourceimage);
         imagedestroy($watermark);
     }
     @unlink($mark_image);
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:59,代码来源:clip.php

示例13: NewMagickWand

$y_int = $height / 10;
$x1 = $x_int;
$y1 = $y_int;
$x2 = $width - $x_int;
$y2 = $height - $y_int;
$x_radius = $y_radius = 10;
$font_size = 30;
$swirl_deg_start = 0;
$swirl_deg_end = 360;
$swirl_deg_int = 60;
$swirl_delay = 10;
$num_morph_frames = 5;
$morph_delay = 20;
$logo = 'MagickWand for PHP';
$welcome_msg = 'The future awaits...';
$mgck_wnd = NewMagickWand();
$bg_color = NewPixelWand();
$white = NewPixelWand('white');
$pxl_wnd = NewPixelWand();
$drw_wnd = NewDrawingWand();
$txt_wnd = NewDrawingWand();
for ($i = 0; $i < $noise_frames; $i++) {
    checkWandError(MagickNewImage($mgck_wnd, $width, $height, $bg_color), $mgck_wnd, __LINE__);
    checkWandError(MagickAddNoiseImage($mgck_wnd, MW_LaplacianNoise), $mgck_wnd, __LINE__);
    checkWandError(MagickSetImageDelay($mgck_wnd, $noise_delay), $mgck_wnd, __LINE__);
}
$pre_morph_wnd =& checkWandError(MagickGetImage($mgck_wnd), $mgck_wnd, __LINE__);
$red = mt_rand(0, 255);
$green = mt_rand(0, 255);
$blue = mt_rand(0, 255);
checkWandError(PixelSetColor($pxl_wnd, "rgb({$red}, {$green}, {$blue})"), $pxl_wnd, __LINE__);
开发者ID:nateirwin,项目名称:custom-historic,代码行数:31,代码来源:demo.php

示例14: image_process_magickwand

 /**
  * Image Process Using MagickWand
  *
  * This function will resize, crop or rotate
  *
  * @access	public
  * @auth	John Meng
  * @param	string
  * @return	bool
  */
 function image_process_magickwand($action = 'resize')
 {
     if (!file_exists($this->full_src_path)) {
         $this->set_error("Image source file not found!");
         return false;
     }
     if (file_exists($this->full_dst_path)) {
         @unlink("{$this->full_dst_path}");
     }
     $magick_wand = NewMagickWand();
     MagickRemoveImageProfiles($magick_wand);
     MagickSetCompressionQuality($magick_wand, $this->quality);
     MagickReadImage($magick_wand, $this->full_src_path);
     switch ($action) {
         case 'crop':
             MagickCropImage($magick_wand, $this->width, $this->height, $this->x_axis, $this->y_axis);
             break;
         case 'rotate':
             switch ($this->rotation_angle) {
                 case 90:
                     $angle = 90;
                     break;
                 case 180:
                     $angle = 180;
                     break;
                 case 270:
                     $angle = 270;
                     break;
                 case 'vrt':
                     $angle = 180;
                     break;
                 case 'hor':
                     $angle = 270;
                     break;
             }
             MagickRotateImage($magick_wand, null, $angle);
             break;
         case 'resize':
         default:
             MagickResizeImage($magick_wand, $this->width, $this->height, MW_LanczosFilter, 1.0);
             break;
     }
     MagickWriteImage($magick_wand, $this->full_dst_path);
     DestroymagickWand($magick_wand);
     // Set the file to 777
     @chmod($this->full_dst_path, $this->dir_write_mode);
     return TRUE;
 }
开发者ID:laiello,项目名称:myopensources,代码行数:58,代码来源:Lib.php

示例15: resizeMobile2

 function resizeMobile2($src_path, $dest_path, $d_width, $d_height)
 {
     $mk = NewMagickWand();
     if (!MagickPingImage($mk, $src_path)) {
         echo "magick wand - no image \n";
         $format = sprintf("convert %s -resize %dx%d -colors 256 -quality 90 -depth 8 %s", $src_path, $destWidth, $destHeight, $dest_path);
         $buffer = "";
         exec($format, $buffer);
         return false;
     }
     // Now we need to clear out the data that MagickPingImage() put there
     ClearMagickWand($mk);
     if (MagickReadImage($mk, $src_path)) {
         list($srcWidth, $srcHeight, $destWidth, $destHeight) = getRate($src_path, $d_width, $d_height);
         //소스 이미지를 읽어서
         $mk = MagickTransformImage($mk, NULL, $destWidth . "x" . $destHeight);
         MagickSetImageCompressionQuality($mk, 90);
         MagickSetImageDepth($mk, 8);
         //MagickSetImageIndex($mk, 256);
         MagickProfileImage($mk, "*", "");
         MagickQuantizeImage($mk, 256, MW_RGBColorspace, 0, true, false);
         //$chk = MagickResizeImage($mk, $destWidth, $destHeight);
         //echo "$src_path , $dest_path, $destWidth, $destHeight \n";
         // 이미지를 리사이징해라. 가로 $w 세로 $h
         //MagickResizeImage() 이라는 함수도 있는데 위의 것이 더 범용적입니다.
         if ($mk == null) {
             //echo "this is convert";
             $format = sprintf("convert %s -resize %dx%d -colors 256 -quality 90 -depth 8 %s", $src_path, $destWidth, $destHeight, $dest_path);
             $buffer = "";
             exec($format, $buffer);
             //echo "object is null \n";
             return true;
         }
         MagickWriteImage($mk, $dest_path);
         // 새로운 이미지를 만들어라~
         ClearMagickWand($mk);
     } else {
         echo "magick wand - read fail \n";
         return false;
     }
     return true;
 }
开发者ID:akswosn,项目名称:tossi,代码行数:42,代码来源:ImageProcess.php


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