• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WideImage_Image类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 /**
  * Returns rotated image
  *
  * @param WideImage_Image $image
  * @param numeric $angle
  * @param int $bgColor
  * @param bool $ignoreTransparent
  * @return WideImage_Image
  */
 function execute($image, $angle, $bgColor, $ignoreTransparent)
 {
     $angle = -floatval($angle);
     if ($angle < 0) {
         $angle = 360 + $angle;
     }
     $angle = $angle % 360;
     if ($angle == 0) {
         return $image->copy();
     }
     if ($bgColor === null) {
         if ($image->isTransparent()) {
             $bgColor = $image->getTransparentColor();
         } else {
             $tc = array('red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127);
             if ($image->isTrueColor()) {
                 $bgColor = $image->getExactColorAlpha($tc);
                 if ($bgColor == -1) {
                     $bgColor = $image->allocateColorAlpha($tc);
                 }
             } else {
                 $bgColor = $image->getExactColor($tc);
                 if ($bgColor == -1) {
                     $bgColor = $image->allocateColor($tc);
                 }
             }
         }
     }
     return new WideImage_TrueColorImage(imagerotate($image->getHandle(), $angle, $bgColor, $ignoreTransparent));
 }
开发者ID:eduardosilvapereira,项目名称:mcja,代码行数:39,代码来源:Rotate.php


示例2:

 /**
  * Apply the manipulation with the setup options to the passed in image.
  * This does not do any memory manipulation
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 public function &apply(WideImage_Image &$image)
 {
     if (!$this->isSetup()) {
         throw new RokGallery_Manipulation_Exception(rc__('ROKGALLERY_MANIPULATION_WAS_NOT_SETUP_PRIOR_TO_APPLYING'));
     }
     $return_image = $image->resize($this->width, $this->height);
     return $return_image;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:15,代码来源:Resize.php


示例3: execute

 /**
  * Executes imagegammacorrect()
  *
  * @param WideImage_Image $image
  * @param numeric $input_gamma
  * @param numeric $output_gamma
  * @return WideImage_TrueColorImage
  */
 function execute($image, $input_gamma, $output_gamma)
 {
     $new = $image->copy();
     if (!imagegammacorrect($new->getHandle(), $input_gamma, $output_gamma)) {
         throw new WideImage_GDFunctionResultException("imagegammacorrect() returned false");
     }
     return $new;
 }
开发者ID:yusuffakhruddin,项目名称:Filemanager,代码行数:16,代码来源:CorrectGamma.php


示例4: execute

 /**
  * Executes imageconvolution() filter.
  *
  * @param WideImage_Image $image
  * @param array           $matrix
  * @param numeric         $div
  * @param numeric         $offset
  *
  * @return WideImage_Image
  */
 public function execute($image, $matrix, $div, $offset)
 {
     $new = $image->asTrueColor();
     if (!imageconvolution($new->getHandle(), $matrix, $div, $offset)) {
         throw new WideImage_GDFunctionResultException('imageconvolution() returned false');
     }
     return $new;
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:18,代码来源:ApplyConvolution.php


示例5: execute

 /**
  * Returns a mirrored image
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $new = $image->copy();
     $width = $image->getWidth();
     $height = $image->getHeight();
     for ($x = 0; $x < $width; $x++) {
         imagecopy($new->getHandle(), $image->getHandle(), $x, 0, $width - $x - 1, 0, 1, $height);
     }
     return $new;
 }
开发者ID:eduardosilvapereira,项目名称:mcja,代码行数:16,代码来源:Mirror.php


示例6: execute

 /**
  * Returns a flipped image
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $new = $image->copy();
     $width = $image->getWidth();
     $height = $image->getHeight();
     for ($y = 0; $y < $height; $y++) {
         imagecopy($new->getHandle(), $image->getHandle(), 0, $y, 0, $height - $y - 1, $width, 1);
     }
     return $new;
 }
开发者ID:eduardosilvapereira,项目名称:mcja,代码行数:16,代码来源:Flip.php


示例7: execute

 /**
  * Rotates and mirrors and image properly based on current orientation value
  *
  * @param WideImage_Image $img
  * @param int $orientation
  * @return WideImage_Image
  */
 function execute($img, $orientation)
 {
     switch ($orientation) {
         case 2:
             return $img->mirror();
             break;
         case 3:
             return $img->rotate(180);
             break;
         case 4:
             return $img->rotate(180)->mirror();
             break;
         case 5:
             return $img->rotate(90)->mirror();
             break;
         case 6:
             return $img->rotate(90);
             break;
         case 7:
             return $img->rotate(-90)->mirror();
             break;
         case 8:
             return $img->rotate(-90);
             break;
         default:
             return $img->copy();
     }
 }
开发者ID:EZTABLE,项目名称:wideimage,代码行数:35,代码来源:ExifOrient.php


示例8: execute

 /**
  * Returns a greyscale copy of an image
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $new = $image->asTrueColor();
     if (!imagefilter($new->getHandle(), IMG_FILTER_GRAYSCALE)) {
         throw new WideImage_GDFunctionResultException("imagefilter() returned false");
     }
     if (!$image->isTrueColor()) {
         $new = $new->asPalette();
     }
     return $new;
 }
开发者ID:NaszvadiG,项目名称:DivaSul,代码行数:17,代码来源:AsGrayscale.php


示例9:

 /**
  * Apply the manipulation with the setup options to the passed in image.
  * This does not do any memory manipulation
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 public function &apply(WideImage_Image &$image)
 {
     if (!$this->isSetup()) {
         throw new RokGallery_Manipulation_Exception(rc__('ROKGALLERY_MANIPULATION_WAS_NOT_SETUP_PRIOR_TO_APPLYING'));
     }
     if ($this->left == 0 && $this->top == 0 && $this->width == 0 && $this->height == 0) {
         $this->width = $image->getWidth();
         $this->height = $image->getHeight();
     }
     $return_image = $image->crop($this->left, $this->top, $this->width, $this->height);
     return $return_image;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:19,代码来源:Crop.php


示例10: execute

 /**
  * Returns a flipped image
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $new = $image->copy();
     $width = $image->getWidth();
     $height = $image->getHeight();
     if ($new->isTransparent()) {
         imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor());
     }
     for ($y = 0; $y < $height; $y++) {
         imagecopy($new->getHandle(), $image->getHandle(), 0, $y, 0, $height - $y - 1, $width, 1);
     }
     return $new;
 }
开发者ID:victorborg3s,项目名称:kimera,代码行数:19,代码来源:Flip.php


示例11: execute

 /**
  * Returns a mirrored image
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $new = $image->copy();
     $width = $image->getWidth();
     $height = $image->getHeight();
     if ($new->isTransparent()) {
         imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor());
     }
     for ($x = 0; $x < $width; $x++) {
         imagecopy($new->getHandle(), $image->getHandle(), $x, 0, $width - $x - 1, 0, 1, $height);
     }
     return $new;
 }
开发者ID:victorborg3s,项目名称:kimera,代码行数:19,代码来源:Mirror.php


示例12: execute

 /**
  * Executes imagefilter
  *
  * @param WideImage_Image $image
  * @param int $filter 
  * @param numeric $arg1
  * @param numeric $arg2
  * @param numeric $arg3
  * @return WideImage_TrueColorImage
  */
 function execute($image, $filter, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null)
 {
     $new = $image->asTrueColor();
     if (in_array($filter, self::$one_arg_filters)) {
         imagefilter($new->getHandle(), $filter, $arg1);
     } elseif (defined('IMG_FILTER_PIXELATE') && $filter == IMG_FILTER_PIXELATE) {
         imagefilter($new->getHandle(), $filter, $arg1, $arg2);
     } elseif ($filter == IMG_FILTER_COLORIZE) {
         imagefilter($new->getHandle(), $filter, $arg1, $arg2, $arg3, $arg4);
     } else {
         imagefilter($new->getHandle(), $filter);
     }
     return $new;
 }
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:24,代码来源:ApplyFilter.php


示例13: execute

 /**
  * Returns a flipped image.
  *
  * @param WideImage_Image $image
  *
  * @return WideImage_Image
  */
 public function execute($image)
 {
     $new = $image->copy();
     $width = $image->getWidth();
     $height = $image->getHeight();
     if ($new->isTransparent()) {
         imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor());
     }
     for ($y = 0; $y < $height; ++$y) {
         if (!imagecopy($new->getHandle(), $image->getHandle(), 0, $y, 0, $height - $y - 1, $width, 1)) {
             throw new WideImage_GDFunctionResultException('imagecopy() returned false');
         }
     }
     return $new;
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:22,代码来源:Flip.php


示例14: execute

 /**
  * Returns a mirrored image
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $new = $image->copy();
     $width = $image->getWidth();
     $height = $image->getHeight();
     if ($new->isTransparent()) {
         imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor());
     }
     for ($x = 0; $x < $width; $x++) {
         if (!imagecopy($new->getHandle(), $image->getHandle(), $x, 0, $width - $x - 1, 0, 1, $height)) {
             throw new WideImage_GDFunctionResultException("imagecopy() returned false");
         }
     }
     return $new;
 }
开发者ID:ehazell,项目名称:AZDWR,代码行数:21,代码来源:Mirror.php


示例15: execute

 /**
  * Returns a greyscale copy of an image
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $palette = $image instanceof WideImage_PaletteImage;
     $transparent = $image->isTransparent();
     if ($palette && $transparent) {
         $tci = $image->getTransparentColor();
     }
     $new = $image->asTrueColor();
     imagefilter($new->getHandle(), IMG_FILTER_GRAYSCALE);
     if ($palette) {
         $new = $new->asPalette();
         if ($transparent) {
             $new->setTransparentColor($tci);
         }
     }
     return $new;
 }
开发者ID:victorborg3s,项目名称:kimera,代码行数:23,代码来源:AsGrayscale.php


示例16: execute

 /**
  * Executes imagefilter
  *
  * @param WideImage_Image $image
  * @param int $filter 
  * @param numeric $arg1
  * @param numeric $arg2
  * @param numeric $arg3
  * @return WideImage_TrueColorImage
  */
 function execute($image, $filter, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null)
 {
     $new = $image->asTrueColor();
     if (in_array($filter, self::$one_arg_filters)) {
         $res = imagefilter($new->getHandle(), $filter, $arg1);
     } elseif (defined('IMG_FILTER_PIXELATE') && $filter == IMG_FILTER_PIXELATE) {
         $res = imagefilter($new->getHandle(), $filter, $arg1, $arg2);
     } elseif ($filter == IMG_FILTER_COLORIZE) {
         $res = imagefilter($new->getHandle(), $filter, $arg1, $arg2, $arg3, $arg4);
     } else {
         $res = imagefilter($new->getHandle(), $filter);
     }
     if (!$res) {
         throw new WideImage_GDFunctionResultException("imagefilter() returned false");
     }
     return $new;
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:27,代码来源:ApplyFilter.php


示例17: prepareDimensions

 /**
  * Prepares and corrects smart coordinates
  *
  * @param WideImage_Image $img
  * @param smart_coordinate $width
  * @param smart_coordinate $height
  * @param string $fit
  * @return array
  */
 protected function prepareDimensions($img, $width, $height, $fit)
 {
     if ($width === null && $height === null) {
         $width = $img->getWidth();
         $height = $img->getHeight();
     }
     if ($width !== null) {
         $width = WideImage_Coordinate::fix($width, $img->getWidth());
     }
     if ($height !== null) {
         $height = WideImage_Coordinate::fix($height, $img->getHeight());
     }
     if ($width === null) {
         $width = floor($img->getWidth() * $height / $img->getHeight());
     }
     if ($height === null) {
         $height = floor($img->getHeight() * $width / $img->getWidth());
     }
     if ($width === 0 || $height === 0) {
         return array('width' => 0, 'height' => 0);
     }
     if ($fit == null) {
         $fit = 'inside';
     }
     $dim = array();
     if ($fit == 'fill') {
         $dim['width'] = $width;
         $dim['height'] = $height;
     } elseif ($fit == 'inside' || $fit == 'outside') {
         $rx = $img->getWidth() / $width;
         $ry = $img->getHeight() / $height;
         if ($fit == 'inside') {
             $ratio = $rx > $ry ? $rx : $ry;
         } else {
             $ratio = $rx < $ry ? $rx : $ry;
         }
         $dim['width'] = round($img->getWidth() / $ratio);
         $dim['height'] = round($img->getHeight() / $ratio);
     } else {
         throw new WideImage_Operation_InvalidFitMethodException("{$fit} is not a valid resize-fit method.");
     }
     return $dim;
 }
开发者ID:mjrouser,项目名称:cityapi,代码行数:52,代码来源:WideImage_Operation_Resize.php


示例18: execute

 /**
  * Returns rotated image
  *
  * @param WideImage_Image $image
  * @param numeric $angle
  * @param int $bgColor
  * @param bool $ignoreTransparent
  * @return WideImage_Image
  */
 function execute($image, $angle, $bgColor, $ignoreTransparent)
 {
     $angle = -floatval($angle);
     if ($angle < 0) {
         $angle = 360 + $angle;
     }
     $angle = $angle % 360;
     if ($angle == 0) {
         return $image->copy();
     }
     $image = $image->asTrueColor();
     if ($bgColor === null) {
         $bgColor = $image->getTransparentColor();
         if ($bgColor == -1) {
             $bgColor = $image->allocateColorAlpha(255, 255, 255, 127);
             imagecolortransparent($image->getHandle(), $bgColor);
         }
     }
     return new WideImage_TrueColorImage(imagerotate($image->getHandle(), $angle, $bgColor, $ignoreTransparent));
 }
开发者ID:NaszvadiG,项目名称:DivaSul,代码行数:29,代码来源:Rotate.php


示例19: execute

 /**
  * Returns a merged image
  *
  * @param WideImage_Image $base
  * @param WideImage_Image $overlay
  * @param smart_coordinate $left
  * @param smart_coordinate $top
  * @param numeric $pct
  * @return WideImage_Image
  */
 function execute($base, $overlay, $left, $top, $pct)
 {
     $x = WideImage_Coordinate::fix($left, $base->getWidth(), $overlay->getWidth());
     $y = WideImage_Coordinate::fix($top, $base->getHeight(), $overlay->getHeight());
     $result = $base->asTrueColor();
     $result->alphaBlending(true);
     $result->saveAlpha(true);
     if ($pct <= 0) {
         return $result;
     }
     if ($pct < 100) {
         imagecopymerge($result->getHandle(), $overlay->getHandle(), $x, $y, 0, 0, $overlay->getWidth(), $overlay->getHeight(), $pct);
     } else {
         imagecopy($result->getHandle(), $overlay->getHandle(), $x, $y, 0, 0, $overlay->getWidth(), $overlay->getHeight());
     }
     return $result;
 }
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:27,代码来源:Merge.php


示例20: execute

 /**
  * Returns a mask
  *
  * @param WideImage_Image $image
  * @return WideImage_Image
  */
 function execute($image)
 {
     $width = $image->getWidth();
     $height = $image->getHeight();
     $mask = WideImage_TrueColorImage::create($width, $height);
     $mask->setTransparentColor(-1);
     $mask->alphaBlending(false);
     $mask->saveAlpha(false);
     for ($i = 0; $i <= 255; $i++) {
         $greyscale[$i] = ImageColorAllocate($mask->getHandle(), $i, $i, $i);
     }
     imagefilledrectangle($mask->getHandle(), 0, 0, $width, $height, $greyscale[255]);
     $transparentColor = $image->getTransparentColor();
     $alphaToGreyRatio = 255 / 127;
     for ($x = 0; $x < $width; $x++) {
         for ($y = 0; $y < $height; $y++) {
             $color = $image->getColorAt($x, $y);
             if ($color == $transparentColor) {
                 $rgba['alpha'] = 127;
             } else {
                 $rgba = $image->getColorRGB($color);
             }
             imagesetpixel($mask->getHandle(), $x, $y, $greyscale[255 - round($rgba['alpha'] * $alphaToGreyRatio)]);
         }
     }
     return $mask;
 }
开发者ID:victorborg3s,项目名称:kimera,代码行数:33,代码来源:GetMask.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Widget类代码示例发布时间:2022-05-23
下一篇:
PHP WideImage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap