本文整理汇总了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));
}
示例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;
}