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


PHP BitmapHandler::getImageArea方法代碼示例

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


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

示例1: testImageArea

 /**
  * @covers BitmapHandler::getImageArea
  */
 public function testImageArea()
 {
     $file = new FakeDimensionFile(array(7, 9));
     $handler = new BitmapHandler();
     $this->assertEquals(63, $handler->getImageArea($file));
 }
開發者ID:MediaWiki-stable,項目名稱:1.26.1,代碼行數:9,代碼來源:BitmapScalingTest.php

示例2: getHandlerOptions

	/**
	 * Check the file and params against $wgVipsOptions
	 *
	 * @param BitmapHandler $handler
	 * @param File $file
	 * @param array $params
	 * @return bool
	 */
	protected static function getHandlerOptions( $handler, $file, $params ) {
		global $wgVipsOptions;
		# Iterate over conditions
		foreach ( $wgVipsOptions as $option ) {
			if ( isset( $option['conditions'] ) ) {
				$condition = $option['conditions'];
			} else {
				# Unconditionally pass
				return $option;
			}

			if ( isset( $condition['mimeType'] ) &&
					$file->getMimeType() != $condition['mimeType'] ) {
				continue;
			}

			$area = $handler->getImageArea( $file );
			if ( isset( $condition['minArea'] ) && $area < $condition['minArea'] ) {
				continue;
			}
			if ( isset( $condition['maxArea'] ) && $area >= $condition['maxArea'] ) {
				continue;
			}

			$shrinkFactor = $file->getWidth() / (
				( ( $handler->getRotation( $file ) % 180 ) == 90 ) ?
				$params['physicalHeight'] : $params['physicalWidth'] );
			if ( isset( $condition['minShrinkFactor'] ) &&
					$shrinkFactor < $condition['minShrinkFactor'] ) {
				continue;
			}
			if ( isset( $condition['maxShrinkFactor'] ) &&
					$shrinkFactor >= $condition['maxShrinkFactor'] ) {
				continue;
			}

			# This condition passed
			return $option;
		}
		# All conditions failed
		return false;
	}
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:50,代碼來源:VipsScaler_body.php


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