本文整理匯總了PHP中Imagick::rotateImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Imagick::rotateImage方法的具體用法?PHP Imagick::rotateImage怎麽用?PHP Imagick::rotateImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Imagick
的用法示例。
在下文中一共展示了Imagick::rotateImage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rotate
/**
* Rotates an image to $deg degree
* @param integer $deg: The amount to rotate
* @param string $bgcolor: The background color in html hexadecimal notation
* @return sfFilebasePluginImage $image: THe rotated image
*/
public function rotate($deg, $bgcolor)
{
$ret_val = $this->destination_resource->rotateImage(new ImagickPixel($bgcolor), $deg);
if ($ret_val !== true) {
throw new sfFilebasePluginException(sprintf('Failed to rotate image %s.', $this->source));
}
return $ret_val;
}
示例2: _rotate
protected function _rotate($degrees)
{
if ($this->im->rotateImage(new ImagickPixel(), $degrees)) {
$this->width = $this->im->getImageWidth();
$this->height = $this->im->getImageHeight();
return true;
}
return false;
}
示例3: gradientRight
function gradientRight($width, $height)
{
$imagick = new Imagick();
$imagick->newPseudoImage($width, $height, 'gradient:white-black');
$imagick->rotateImage('none', 90);
return $imagick;
}
示例4: rotate
/**
* @param $angle
* @param bool $autoResize
* @param string $color
* @return Pimcore_Image_Adapter_Imagick
*/
public function rotate($angle)
{
$this->resource->rotateImage(new ImagickPixel('none'), $angle);
$this->setWidth($this->resource->getimagewidth());
$this->setHeight($this->resource->getimageheight());
$this->reinitializeImage();
return $this;
}
示例5: _rotate
/**
* Rotate the image.
* @param int $degrees
*/
protected function _rotate($degrees)
{
if ($this->im->rotateImage(new \ImagickPixel('transparent'), $degrees)) {
$this->width = $this->im->getImageWidth();
$this->height = $this->im->getImageHeight();
$this->im->setImagePage($this->width, $this->height, 0, 0);
}
}
示例6: rotate
/**
* Rotate the image by a given degrees
*
* @param int $degrees
* @param int $background
* @param float $alpha
*
* @return static
*/
public function rotate($degrees, $background = 0xffffff, $alpha = 1.0)
{
$backgroundColor = sprintf('rgba(%u,%u,%u,%f)', $background >> 16 & 0xff, $background >> 8 & 0xff, $background & 0xff, $alpha);
$this->_image->rotateImage(new \ImagickPixel($backgroundColor), $degrees);
$this->_image->setImagePage($this->_width, $this->_height, 0, 0);
$this->_width = $this->_image->getImageWidth();
$this->_height = $this->_image->getImageHeight();
return $this;
}
示例7: rotate
public static function rotate(Imagick $image, $params)
{
if (isset($params[0])) {
$angle = $params[0];
if ($angle > 0 && $angle < 360) {
$image->rotateImage(new ImagickPixel('none'), $angle);
}
}
}
示例8: rotate
/**
* Rotate the current image.
*
* @param integer $angle The angle to rotate the image by,
* in the clockwise direction.
* @param integer $background The background color to fill any triangles.
*/
public function rotate($angle, $background = 'white')
{
try {
$this->_imagick->rotateImage($background, $angle);
} catch (ImagickException $e) {
throw new Horde_Image_Exception($e);
}
$this->clearGeometry();
}
示例9: rotate
public function rotate($angle)
{
// Rotate
try {
$return = $this->_resource->rotateImage(new ImagickPixel('none'), $angle);
} catch (ImagickException $e) {
throw new Engine_Image_Adapter_Exception(sprintf('Unable to rotate image: %s', $e->getMessage()), $e->getCode());
}
return $this;
}
示例10: rotate
public function rotate($degree, $color = 'FFFFFF')
{
$rgb = $this->html2rgb($color);
for ($r = 0; $r < count($this->image); $r++) {
$this->image->nextImage();
$this->image->rotateImage(new ImagickPixel('rgba(' . $rgb[0] . ',' . $rgb[1] . ',' . $rgb[2] . ',0)'), $degree);
}
$this->info['width'] = $this->image->getImageWidth();
$this->info['height'] = $this->image->getImageHeight();
}
示例11: rotate
/**
* @param $angle
* @return $this
*/
public function rotate($angle)
{
$this->preModify();
$this->resource->rotateImage(new \ImagickPixel('none'), $angle);
$this->setWidth($this->resource->getimagewidth());
$this->setHeight($this->resource->getimageheight());
$this->postModify();
$this->setIsAlphaPossible(true);
return $this;
}
示例12: rotate
public function rotate($newFile, $angle)
{
$imagick = new Imagick();
$imagick->readImage($this->_file);
$imagick->rotateImage(new ImagickPixel('#ffffff'), $angle);
//$imagick->rotateImage(new ImagickPixel('transparent'), $angle);
$imagick->writeImage($newFile);
$imagick->clear();
$imagick->destroy();
}
示例13: process
public function process(\Imagick $image)
{
$info = getimagesize($this->_file);
if ($info['mime'] != 'image/jpeg') {
return $image;
}
if (!($exif_data = exif_read_data($this->_file))) {
return $image;
}
if (isset($exif_data['Orientation'])) {
$ort = $exif_data['Orientation'];
if ($ort > 1) {
switch ($ort) {
case 2:
$image->flopImage();
break;
case 3:
$image->rotateImage(new \ImagickPixel(), 180);
break;
case 4:
$image->flipImage();
break;
case 5:
$image->flopImage();
$image->rotateImage(new \ImagickPixel(), 270);
break;
case 6:
$image->rotateImage(new \ImagickPixel(), 90);
break;
case 7:
$image->flopImage();
$image->rotateImage(new \ImagickPixel(), 90);
break;
case 8:
$image->rotateImage(new \ImagickPixel(), 270);
break;
}
}
}
return $image;
}
示例14: convertExifToJFIF
/**
* 入力された畫像がExifであればエラーを記録し、JFIFに変換します。
* @param \Imagick $imagick JFIFかExif。
*/
protected function convertExifToJFIF(\Imagick $imagick)
{
if ($imagick->getImageProperties('exif:*')) {
$this->logger->error(sprintf(_('「%s」はExif形式です。'), $this->filename));
switch ($imagick->getImageOrientation()) {
case \Imagick::ORIENTATION_TOPRIGHT:
$imagick->flopImage();
break;
case \Imagick::ORIENTATION_BOTTOMRIGHT:
$imagick->rotateImage('none', 180);
break;
case \Imagick::ORIENTATION_BOTTOMLEFT:
$imagick->rotateImage('none', 180);
$imagick->flopImage();
break;
case \Imagick::ORIENTATION_LEFTTOP:
$imagick->rotateImage('none', 90);
$imagick->flopImage();
break;
case \Imagick::ORIENTATION_RIGHTTOP:
$imagick->rotateImage('none', 90);
break;
case \Imagick::ORIENTATION_RIGHTBOTTOM:
$imagick->rotateImage('none', 270);
$imagick->flopImage();
break;
case \Imagick::ORIENTATION_LEFTBOTTOM:
$imagick->rotateImage('none', 270);
break;
}
$imagick->stripImage();
}
}
示例15: rotate
public function rotate($angle, $bg_color = 0xffffff, $bg_opacity = 0)
{
if ($this->multiframe()) {
foreach ($this->image as $frame) {
$frame->rotateImage($this->get_color($bg_color, $bg_opacity), -$angle);
$frame->setImagePage($this->image->width, $this->image->height, 0, 0);
}
} else {
$this->image->rotateImage($this->get_color($bg_color, $bg_opacity), -$angle);
}
$this->update_size($this->image->getImageWidth(), $this->image->getImageHeight());
return $this;
}