當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Imagick::flopImage方法代碼示例

本文整理匯總了PHP中Imagick::flopImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Imagick::flopImage方法的具體用法?PHP Imagick::flopImage怎麽用?PHP Imagick::flopImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Imagick的用法示例。


在下文中一共展示了Imagick::flopImage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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();
     }
 }
開發者ID:esperecyan,項目名稱:dictionary-php,代碼行數:37,代碼來源:ImageValidator.php

示例2: flipHorizontally

 /**
  * (non-PHPdoc)
  * @see Imagine\ImageInterface::flipHorizontally()
  */
 public function flipHorizontally()
 {
     try {
         $this->imagick->flopImage();
     } catch (\ImagickException $e) {
         throw new RuntimeException('Horizontal Flip operation failed', $e->getCode(), $e);
     }
     return $this;
 }
開發者ID:nicodmf,項目名稱:Imagine,代碼行數:13,代碼來源:Image.php

示例3: mirror

 /**
  * Mirror the current image.
  */
 public function mirror()
 {
     try {
         $this->_imagick->flopImage();
     } catch (ImagickException $e) {
         throw new Horde_Image_Exception($e);
     }
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:11,代碼來源:Imagick.php

示例4: mirror

 /**
  * Horizontal mirroring
  *
  * @return bool|PEAR_Error TRUE or a PEAR_Error object on error
  * @access public
  */
 function mirror()
 {
     try {
         $this->imagick->flopImage();
     } catch (ImagickException $e) {
         return $this->raiseError('Could not mirror the image.', IMAGE_TRANSFORM_ERROR_FAILED);
     }
     return true;
 }
開發者ID:rivetweb,項目名稱:old-book-with-active-areas,代碼行數:15,代碼來源:Imagick3.php

示例5: flip

 public function flip($flipX = false, $flipY = false)
 {
     if ($flipX) {
         $this->image->flopImage();
     }
     if ($flipY) {
         $this->image->flipImage();
     }
     return $this;
 }
開發者ID:phpixie,項目名稱:image,代碼行數:10,代碼來源:Resource.php

示例6: 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();
     }
 }
開發者ID:muhammetardayildiz,項目名稱:framework,代碼行數:13,代碼來源:ImageMagick.php

示例7: fixImageOrientation

 /**
  * @ref http://www.b-prep.com/blog/?p=1764
  *
  * @param \Imagick $image
  * @return \Imagick
  */
 private function fixImageOrientation($image)
 {
     $orientation = $image->getImageOrientation();
     switch ($orientation) {
         case \Imagick::ORIENTATION_UNDEFINED:
             break;
         case \Imagick::ORIENTATION_TOPLEFT:
             break;
         case \Imagick::ORIENTATION_TOPRIGHT:
             $image->flopImage();
             $image->setimageorientation(\Imagick::ORIENTATION_TOPLEFT);
             break;
         case \Imagick::ORIENTATION_BOTTOMRIGHT:
             $image->rotateImage(new \ImagickPixel(), 180);
             $image->setimageorientation(\Imagick::ORIENTATION_TOPLEFT);
             break;
         case \Imagick::ORIENTATION_BOTTOMLEFT:
             $image->rotateImage(new \ImagickPixel(), 180);
             $image->flopImage();
             $image->setimageorientation(\Imagick::ORIENTATION_TOPLEFT);
             break;
         case \Imagick::ORIENTATION_LEFTTOP:
             $image->rotateImage(new \ImagickPixel(), 90);
             $image->flopImage();
             $image->setimageorientation(\Imagick::ORIENTATION_TOPLEFT);
             break;
         case \Imagick::ORIENTATION_RIGHTTOP:
             $image->rotateImage(new \ImagickPixel(), 90);
             $image->setimageorientation(\Imagick::ORIENTATION_TOPLEFT);
             break;
         case \Imagick::ORIENTATION_RIGHTBOTTOM:
             $image->rotateImage(new \ImagickPixel(), 270);
             $image->flopImage();
             $image->setimageorientation(\Imagick::ORIENTATION_TOPLEFT);
             break;
         case \Imagick::ORIENTATION_LEFTBOTTOM:
             $image->rotateImage(new \ImagickPixel(), 270);
             $image->setimageorientation(\Imagick::ORIENTATION_TOPLEFT);
             break;
     }
     return $image;
 }
開發者ID:ykusakabe,項目名稱:laravel-51-boilerplate,代碼行數:48,代碼來源:ImageService.php

示例8: 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;
 }
開發者ID:emanuel-london,項目名稱:pimcore,代碼行數:15,代碼來源:Imagick.php

示例9: 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;
 }
開發者ID:romainbureau,項目名稱:Custom,代碼行數:41,代碼來源:FixOrientation.php

示例10: 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;
	}
開發者ID:ShankarVellal,項目名稱:WordPress,代碼行數:23,代碼來源:class-wp-image-editor-imagick.php

示例11: 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;
 }
開發者ID:febryantosulistyo,項目名稱:ClassicSocial,代碼行數:14,代碼來源:Imagick.php

示例12: 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();
 }
開發者ID:piratevn,項目名稱:cms-gio,代碼行數:16,代碼來源:ImageMagick.php

示例13: 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;
 }
開發者ID:anp135,項目名稱:altocms,代碼行數:22,代碼來源:Imagick.php

示例14: imagick_orient_image

 protected function imagick_orient_image(\Imagick $image)
 {
     $orientation = $image->getImageOrientation();
     $background = new \ImagickPixel('none');
     switch ($orientation) {
         case \imagick::ORIENTATION_TOPRIGHT:
             // 2
             $image->flopImage();
             // horizontal flop around y-axis
             break;
         case \imagick::ORIENTATION_BOTTOMRIGHT:
             // 3
             $image->rotateImage($background, 180);
             break;
         case \imagick::ORIENTATION_BOTTOMLEFT:
             // 4
             $image->flipImage();
             // vertical flip around x-axis
             break;
         case \imagick::ORIENTATION_LEFTTOP:
             // 5
             $image->flopImage();
             // horizontal flop around y-axis
             $image->rotateImage($background, 270);
             break;
         case \imagick::ORIENTATION_RIGHTTOP:
             // 6
             $image->rotateImage($background, 90);
             break;
         case \imagick::ORIENTATION_RIGHTBOTTOM:
             // 7
             $image->flipImage();
             // vertical flip around x-axis
             $image->rotateImage($background, 270);
             break;
         case \imagick::ORIENTATION_LEFTBOTTOM:
             // 8
             $image->rotateImage($background, 270);
             break;
         default:
             return false;
     }
     $image->setImageOrientation(\imagick::ORIENTATION_TOPLEFT);
     // 1
     return true;
 }
開發者ID:necatikartal,項目名稱:ojs,代碼行數:46,代碼來源:ImageResizeHelper.php

示例15: createMediaFromJSON

 public function createMediaFromJSON($glob)
 {
     $path = $glob->path;
     $filename = $glob->filename;
     $data = $glob->data;
     $resizeTo = isset($glob->resizeTo) ? $glob->resizeTo : null;
     $gameMediaDirectory = Media::getMediaDirectory($path)->data;
     $md5 = md5((string) microtime() . $filename);
     $ext = strtolower(substr($filename, -3));
     $newMediaFileName = 'aris' . $md5 . '.' . $ext;
     $resizedMediaFileName = 'aris' . $md5 . '_128.' . $ext;
     if ($ext != "jpg" && $ext != "png" && $ext != "gif" && $ext != "mp4" && $ext != "mov" && $ext != "m4v" && $ext != "3gp" && $ext != "caf" && $ext != "mp3" && $ext != "aac" && $ext != "m4a" && $ext != "zip") {
         return new returnData(1, NULL, "Invalid filetype:{$ext}");
     }
     $fullFilePath = $gameMediaDirectory . "/" . $newMediaFileName;
     if (isset($resizeTo) && ($ext == "jpg" || $ext == "png" || $ext == "gif")) {
         $bigFilePath = $gameMediaDirectory . "/big_" . $newMediaFileName;
         $fp = fopen($bigFilePath, 'w');
         if (!$fp) {
             return new returnData(1, NULL, "Couldn't open file:{$bigFilePath}");
         }
         fwrite($fp, base64_decode($data));
         fclose($fp);
         $image = new Imagick($bigFilePath);
         // Reorient based on EXIF tag
         switch ($image->getImageOrientation()) {
             case Imagick::ORIENTATION_UNDEFINED:
                 // We assume normal orientation
                 break;
             case Imagick::ORIENTATION_TOPLEFT:
                 // All good
                 break;
             case Imagick::ORIENTATION_TOPRIGHT:
                 $image->flopImage();
                 break;
             case Imagick::ORIENTATION_BOTTOMRIGHT:
                 $image->rotateImage('#000', 180);
                 break;
             case Imagick::ORIENTATION_BOTTOMLEFT:
                 $image->rotateImage('#000', 180);
                 $image->flopImage();
                 break;
             case Imagick::ORIENTATION_LEFTTOP:
                 $image->rotateImage('#000', 90);
                 $image->flopImage();
                 break;
             case Imagick::ORIENTATION_RIGHTTOP:
                 $image->rotateImage('#000', 90);
                 break;
             case Imagick::ORIENTATION_RIGHTBOTTOM:
                 $image->rotateImage('#000', -90);
                 $image->flopImage();
                 break;
             case Imagick::ORIENTATION_LEFTBOTTOM:
                 $image->rotateImage('#000', -90);
                 break;
         }
         $image->setImageOrientation(Imagick::ORIENTATION_TOPLEFT);
         // Resize image proportionally so min(width, height) == $resizeTo
         if ($image->getImageWidth() < $image->getImageHeight()) {
             $image->resizeImage($resizeTo, 0, Imagick::FILTER_LANCZOS, 1);
         } else {
             $image->resizeImage(0, $resizeTo, Imagick::FILTER_LANCZOS, 1);
         }
         $image->setImageCompression(Imagick::COMPRESSION_JPEG);
         $image->setImageCompressionQuality(40);
         $image->writeImage($fullFilePath);
         unlink($bigFilePath);
     } else {
         $fp = fopen($fullFilePath, 'w');
         if (!$fp) {
             return new returnData(1, NULL, "Couldn't open file:{$fullFilePath}");
         }
         fwrite($fp, base64_decode($data));
         fclose($fp);
     }
     if ($ext == "jpg" || $ext == "png" || $ext == "gif") {
         $img = WideImage::load($fullFilePath);
         $img = $img->resize(128, 128, 'outside');
         $img = $img->crop('center', 'center', 128, 128);
         $img->saveToFile($gameMediaDirectory . "/" . $resizedMediaFileName);
     } else {
         if ($ext == "mp4") {
             /*
               $ffmpeg = '../../libraries/ffmpeg';
               $videoFilePath      = $gameMediaDirectory."/".$newMediaFileName; 
               $tempImageFilePath  = $gameMediaDirectory."/temp_".$resizedMediaFileName; 
               $imageFilePath      = $gameMediaDirectory."/".$resizedMediaFileName; 
               $cmd = "$ffmpeg -i $videoFilePath 2>&1"; 
               $thumbTime = 1;
               if(preg_match('/Duration: ((\d+):(\d+):(\d+))/s', shell_exec($cmd), $videoLength))
               $thumbTime = (($videoLength[2] * 3600) + ($videoLength[3] * 60) + $videoLength[4])/2; 
               $cmd = "$ffmpeg -i $videoFilePath -deinterlace -an -ss $thumbTime -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $tempImageFilePath 2>&1"; 
               shell_exec($cmd);
             
               $img = WideImage::load($tempImageFilePath);
               $img = $img->resize(128, 128, 'outside');
               $img = $img->crop('center','center',128,128);
               $img->saveToFile($imageFilePath);
             */
//.........這裏部分代碼省略.........
開發者ID:kimblemj,項目名稱:server,代碼行數:101,代碼來源:media.php


注:本文中的Imagick::flopImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。