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


PHP WideImage_Image::copy方法代码示例

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


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

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

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

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

 /**
  * 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

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

示例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();
     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

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

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

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

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

示例11: execute

 /**
  * @param WideImage_Image $image
  * @param int $radius
  * @param int $color
  * @param int $smoothness
  * @return WideImage_Image
  */
 function execute($image, $radius, $color, $smoothness, $corners)
 {
     if ($smoothness < 1) {
         $sample_ratio = 1;
     } elseif ($smoothness > 16) {
         $sample_ratio = 16;
     } else {
         $sample_ratio = $smoothness;
     }
     $corner = WideImage::createTrueColorImage($radius * $sample_ratio, $radius * $sample_ratio);
     if ($color === null) {
         imagepalettecopy($corner->getHandle(), $image->getHandle());
         $bg_color = $corner->allocateColor(0, 0, 0);
         $corner->fill(0, 0, $bg_color);
         $fg_color = $corner->allocateColor(255, 255, 255);
         $corner->getCanvas()->filledEllipse($radius * $sample_ratio, $radius * $sample_ratio, $radius * 2 * $sample_ratio, $radius * 2 * $sample_ratio, $fg_color);
         $corner = $corner->resize($radius, $radius);
         $result = $image->asTrueColor();
         $tc = $result->getTransparentColor();
         if ($tc == -1) {
             $tc = $result->allocateColorAlpha(255, 255, 255, 127);
             imagecolortransparent($result->getHandle(), $tc);
             $result->setTransparentColor($tc);
         }
         if ($corners & WideImage::SIDE_TOP_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_TOP) {
             $result = $result->applyMask($corner, -1, -1);
         }
         $corner = $corner->rotate(90);
         if ($corners & WideImage::SIDE_TOP_RIGHT || $corners & WideImage::SIDE_TOP || $corners & WideImage::SIDE_RIGHT) {
             $result = $result->applyMask($corner, $result->getWidth() - $corner->getWidth() + 1, -1, 100);
         }
         $corner = $corner->rotate(90);
         if ($corners & WideImage::SIDE_BOTTOM_RIGHT || $corners & WideImage::SIDE_RIGHT || $corners & WideImage::SIDE_BOTTOM) {
             $result = $result->applyMask($corner, $result->getWidth() - $corner->getWidth() + 1, $result->getHeight() - $corner->getHeight() + 1, 100);
         }
         $corner = $corner->rotate(90);
         if ($corners & WideImage::SIDE_BOTTOM_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_BOTTOM) {
             $result = $result->applyMask($corner, -1, $result->getHeight() - $corner->getHeight() + 1, 100);
         }
         return $result;
     } else {
         $bg_color = $color;
         $corner->fill(0, 0, $bg_color);
         $fg_color = $corner->allocateColorAlpha(127, 127, 127, 127);
         $corner->getCanvas()->filledEllipse($radius * $sample_ratio, $radius * $sample_ratio, $radius * 2 * $sample_ratio, $radius * 2 * $sample_ratio, $fg_color);
         $corner = $corner->resize($radius, $radius);
         $result = $image->copy();
         if ($corners & WideImage::SIDE_TOP_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_TOP) {
             $result = $result->merge($corner, -1, -1, 100);
         }
         $corner = $corner->rotate(90);
         if ($corners & WideImage::SIDE_TOP_RIGHT || $corners & WideImage::SIDE_TOP || $corners & WideImage::SIDE_RIGHT) {
             $result = $result->merge($corner, $result->getWidth() - $corner->getWidth() + 1, -1, 100);
         }
         $corner = $corner->rotate(90);
         if ($corners & WideImage::SIDE_BOTTOM_RIGHT || $corners & WideImage::SIDE_RIGHT || $corners & WideImage::SIDE_BOTTOM) {
             $result = $result->merge($corner, $result->getWidth() - $corner->getWidth() + 1, $result->getHeight() - $corner->getHeight() + 1, 100);
         }
         $corner = $corner->rotate(90);
         if ($corners & WideImage::SIDE_BOTTOM_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_BOTTOM) {
             $result = $result->merge($corner, -1, $result->getHeight() - $corner->getHeight() + 1, 100);
         }
         return $result;
     }
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:72,代码来源:RoundCorners.php

示例12: execute

 /**
  * Executes the auto-crop operation on the $img
  * 
  * @param WideImage_Image $img 
  * @param int $rgb_threshold The difference in RGB from $base_color
  * @param int $pixel_cutoff The number of pixels on each border that must be over $rgb_threshold
  * @param int $base_color The color that will get cropped
  * @return WideImage_Image resulting auto-cropped image
  */
 function execute($img, $margin, $rgb_threshold, $pixel_cutoff, $base_color)
 {
     $margin = intval($margin);
     $rgb_threshold = intval($rgb_threshold);
     if ($rgb_threshold < 0) {
         $rgb_threshold = 0;
     }
     $pixel_cutoff = intval($pixel_cutoff);
     if ($pixel_cutoff <= 1) {
         $pixel_cutoff = 1;
     }
     if ($base_color === null) {
         $rgb_base = $img->getRGBAt(0, 0);
     } else {
         if ($base_color < 0) {
             return $img->copy();
         }
         $rgb_base = $img->getColorRGB($base_color);
     }
     $cut_rect = array('left' => 0, 'top' => 0, 'right' => $img->getWidth() - 1, 'bottom' => $img->getHeight() - 1);
     for ($y = 0; $y <= $cut_rect['bottom']; $y++) {
         $count = 0;
         for ($x = 0; $x <= $cut_rect['right']; $x++) {
             $rgb = $img->getRGBAt($x, $y);
             $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']);
             if ($diff > $rgb_threshold) {
                 $count++;
                 if ($count >= $pixel_cutoff) {
                     $cut_rect['top'] = $y;
                     break 2;
                 }
             }
         }
     }
     for ($y = $img->getHeight() - 1; $y >= $cut_rect['top']; $y--) {
         $count = 0;
         for ($x = 0; $x <= $cut_rect['right']; $x++) {
             $rgb = $img->getRGBAt($x, $y);
             $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']);
             if ($diff > $rgb_threshold) {
                 $count++;
                 if ($count >= $pixel_cutoff) {
                     $cut_rect['bottom'] = $y;
                     break 2;
                 }
             }
         }
     }
     for ($x = 0; $x <= $cut_rect['right']; $x++) {
         $count = 0;
         for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) {
             $rgb = $img->getRGBAt($x, $y);
             $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']);
             if ($diff > $rgb_threshold) {
                 $count++;
                 if ($count >= $pixel_cutoff) {
                     $cut_rect['left'] = $x;
                     break 2;
                 }
             }
         }
     }
     for ($x = $cut_rect['right']; $x >= $cut_rect['left']; $x--) {
         $count = 0;
         for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) {
             $rgb = $img->getRGBAt($x, $y);
             $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']);
             if ($diff > $rgb_threshold) {
                 $count++;
                 if ($count >= $pixel_cutoff) {
                     $cut_rect['right'] = $x;
                     break 2;
                 }
             }
         }
     }
     $cut_rect = array('left' => $cut_rect['left'] - $margin, 'top' => $cut_rect['top'] - $margin, 'right' => $cut_rect['right'] + $margin, 'bottom' => $cut_rect['bottom'] + $margin);
     if ($cut_rect['left'] < 0) {
         $cut_rect['left'] = 0;
     }
     if ($cut_rect['top'] < 0) {
         $cut_rect['top'] = 0;
     }
     if ($cut_rect['right'] >= $img->getWidth()) {
         $cut_rect['right'] = $img->getWidth() - 1;
     }
     if ($cut_rect['bottom'] >= $img->getHeight()) {
         $cut_rect['bottom'] = $img->getHeight() - 1;
     }
     return $img->crop($cut_rect['left'], $cut_rect['top'], $cut_rect['right'] - $cut_rect['left'] + 1, $cut_rect['bottom'] - $cut_rect['top'] + 1);
 }
开发者ID:NaszvadiG,项目名称:DivaSul,代码行数:100,代码来源:AutoCrop.php

示例13: 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();
     imagegammacorrect($new->getHandle(), $input_gamma, $output_gamma);
     return $new;
 }
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:14,代码来源:CorrectGamma.php


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