本文整理汇总了PHP中WideImage_Image类的典型用法代码示例。如果您正苦于以下问题:PHP WideImage_Image类的具体用法?PHP WideImage_Image怎么用?PHP WideImage_Image使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WideImage_Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}