本文整理匯總了PHP中Imagick::flipImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Imagick::flipImage方法的具體用法?PHP Imagick::flipImage怎麽用?PHP Imagick::flipImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Imagick
的用法示例。
在下文中一共展示了Imagick::flipImage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: flip
/**
* Flip the current image.
*/
public function flip()
{
try {
$this->_imagick->flipImage();
} catch (ImagickException $e) {
throw new Horde_Image_Exception($e);
}
}
示例2: flip
/**
* Vertical mirroring
*
* @return bool|PEAR_Error TRUE or a PEAR_Error object on error
* @access public
*/
function flip()
{
try {
$this->imagick->flipImage();
} catch (ImagickException $e) {
return $this->raiseError('Could not flip the image.', IMAGE_TRANSFORM_ERROR_FAILED);
}
return true;
}
示例3: flipVertically
/**
* {@inheritdoc}
*
* @return ImageInterface
*/
public function flipVertically()
{
try {
$this->imagick->flipImage();
} catch (\ImagickException $e) {
throw new RuntimeException('Vertical flip operation failed', $e->getCode(), $e);
}
return $this;
}
示例4: flip
/**
* {@inheritdoc}
*/
public function flip($direction = Image::FLIP_HORIZONTAL)
{
if ($direction === Image::FLIP_VERTICAL) {
// Flips the image in the vertical direction
$this->image->flipImage();
} else {
// Flips the image in the horizontal direction
$this->image->flopImage();
}
}
示例5: flip
public function flip($flipX = false, $flipY = false)
{
if ($flipX) {
$this->image->flopImage();
}
if ($flipY) {
$this->image->flipImage();
}
return $this;
}
示例6: mirror
/**
* @param $mode
* @return $this|Adapter
*/
public function mirror($mode)
{
$this->preModify();
if ($mode == "vertical") {
$this->resource->flipImage();
} elseif ($mode == "horizontal") {
$this->resource->flopImage();
}
$this->postModify();
return $this;
}
示例7: flip
/**
* Flips current image.
*
* @since 3.5.0
* @access public
*
* @param boolean $horz Flip along Horizontal Axis
* @param boolean $vert Flip along Vertical Axis
* @returns true|WP_Error
*/
public function flip( $horz, $vert ) {
try {
if ( $horz )
$this->image->flipImage();
if ( $vert )
$this->image->flopImage();
}
catch ( Exception $e ) {
return new WP_Error( 'image_flip_error', $e->getMessage() );
}
return true;
}
示例8: flip
public function flip($horizontal = true)
{
// Flip
try {
if ($horizontal) {
$return = $this->_resource->flopImage();
} else {
$return = $this->_resource->flipImage();
}
} catch (ImagickException $e) {
throw new Engine_Image_Adapter_Exception(sprintf('Unable to flip image: %s', $e->getMessage()), $e->getCode());
}
return $this;
}
示例9: flip
public function flip($newFile, $mode)
{
$imagick = new Imagick();
$imagick->readImage($this->_file);
switch ($mode) {
case Tomato_Image_Abstract::FLIP_VERTICAL:
$imagick->flipImage();
break;
case Tomato_Image_Abstract::FLIP_HORIZONTAL:
$imagick->flopImage();
break;
}
$imagick->writeImage($newFile);
$imagick->clear();
$imagick->destroy();
}
示例10: 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;
}
示例11: flip
public function flip($flip_x = false, $flip_y = false)
{
if ($flip_x) {
if ($this->multiframe()) {
foreach ($this->image as $frame) {
$frame->flopImage();
}
} else {
$this->image->flopImage();
}
}
if ($flip_y) {
if ($this->multiframe()) {
foreach ($this->image as $frame) {
$frame->flipImage();
}
} else {
$this->image->flipImage();
}
}
return $this;
}
示例12: uniqid
} else {
print "Possible file upload attack!\n";
}
$s3 = new Aws\S3\S3Client(['version' => 'latest', 'region' => 'us-east-1']);
$bucket = uniqid("S3-Sukanya-", false);
//print "Creating bucket named {$bucket}\n";
$result = $s3->createBucket(['ACL' => 'public-read', 'Bucket' => $bucket]);
$result = $s3->waitUntil('BucketExists', array('Bucket' => $bucket));
//echo "bucket creation done";
$result = $s3->putObject(['ACL' => 'public-read', 'Bucket' => $bucket, 'Key' => "uploads" . $uploadfile, 'ContentType' => $_FILES['userfile']['type'], 'Body' => fopen($uploadfile, 'r+')]);
$url = $result['ObjectURL'];
//adding expiration to bucket
$objectrule = $s3->putBucketLifecycleConfiguration(['Bucket' => $bucket, 'LifecycleConfiguration' => ['Rules' => [['Expiration' => ['Days' => 1], 'NoncurrentVersionExpiration' => ['NoncurrentDays' => 1], 'Prefix' => ' ', 'Status' => 'Enabled']]]]);
// reference http://php.net/manual/en/imagick.writeimage.php
$filepath = new Imagick($uploadfile);
$filepath->flipImage();
mkdir("/tmp/Imagick");
$extension = end(explode('.', $filename));
echo "extension here";
echo $extension;
$path = '/tmp/Imagick/';
$imgid = uniqid("DesImage");
$imgloc = $imgid . '.' . $extension;
$DestPath = $path . $imgloc;
echo $DestPath;
///tmp/Imagick/DesImage56553cb459719.png
//$filepath->setImageFormat ("png");
//file_put_contents ($DestPath, $filepath);
$filepath->writeImage($DestPath);
//bucket creation of flip image
$flipbucket = uniqid("flippedimage", false);
示例13: correctOrientation
/**
* Corrects orientation of an image
* @param \Imagick $im
*/
private function correctOrientation(\Imagick &$im)
{
switch ($im->getImageOrientation()) {
case \Imagick::ORIENTATION_TOPRIGHT:
$im->flipImage();
break;
case \Imagick::ORIENTATION_BOTTOMRIGHT:
$im->rotateImage(new \ImagickPixel("none"), 180);
break;
case \Imagick::ORIENTATION_BOTTOMLEFT:
$im->rotateImage(new \ImagickPixel("none"), 180);
$im->flipImage();
break;
case \Imagick::ORIENTATION_LEFTTOP:
$im->rotateImage(new \ImagickPixel("none"), 90);
$im->flipImage();
break;
case \Imagick::ORIENTATION_RIGHTTOP:
$im->rotateImage(new \ImagickPixel("none"), 90);
break;
case \Imagick::ORIENTATION_RIGHTBOTTOM:
$im->rotateImage(new \ImagickPixel("none"), -90);
$im->flipImage();
break;
case \Imagick::ORIENTATION_LEFTBOTTOM:
$im->rotateImage(new \ImagickPixel("none"), -90);
break;
default:
}
}
示例14: flip
/**
* Applies a vertical mirror on the image
*
* @return Imagick
*/
public function flip()
{
$this->image->flipImage();
$this->operations[] = 'flip';
return $this;
}
示例15: _rotate
/**
* 水平翻轉(左右翻轉)或垂直翻轉(上下翻轉)
* @param Imagick $im
* @param string $hv
* @return boolean
*/
private function _rotate(&$im, $hv)
{
if (self::ROTATE_H == $hv) {
// 水平翻轉
$boolean = $im->flopImage();
} elseif (self::ROTATE_V == $hv) {
// 垂直翻轉
$boolean = $im->flipImage();
} else {
$this->_error = '參數錯誤';
$this->_im = null;
return false;
}
if ($boolean) {
return true;
} else {
$this->_error = '翻轉失敗';
$this->_im = null;
return false;
}
}