}
unset( $repo ); // no global pollution; destroy reference
-if ( is_null( $wgEnableAutoRotation ) ) {
- wfProfileIn( $fname . '-defaults-rotation' );
- // Only enable auto-rotation when the bitmap handler can rotate
- $wgEnableAutoRotation = BitmapHandler::canRotate();
- wfProfileOut( $fname . '-defaults-rotation' );
-}
-
if ( $wgRCFilterByAge ) {
# # Trim down $wgRCLinkDays so that it only lists links which are valid
# # as determined by $wgRCMaxAge.
}
}
+ /**
+ * @see $wgEnableAutoRotation
+ * @return bool Whether auto rotation is enabled
+ */
+ public static function autoRotateEnabled() {
+ global $wgEnableAutoRotation;
+
+ if ( $wgEnableAutoRotation === null ) {
+ // Only enable auto-rotation when the bitmap handler can rotate
+ $wgEnableAutoRotation = BitmapHandler::canRotate();
+ }
+
+ return $wgEnableAutoRotation;
+ }
+
/**
* @param File $file
* @param array $params Rotate parameters.
* @return array
*/
function getImageSize( $image, $path ) {
- global $wgEnableAutoRotation;
$gis = parent::getImageSize( $image, $path );
// Don't just call $image->getMetadata(); FSFile::getPropsFromPath() calls us with a bogus object.
// This may mean we read EXIF data twice on initial upload.
- if ( $wgEnableAutoRotation ) {
+ if ( BitmapHandler::autoRotateEnabled() ) {
$meta = $this->getMetadata( $image, $path );
$rotation = $this->getRotationForExif( $meta );
} else {
* @return int 0, 90, 180 or 270
*/
public function getRotation( $file ) {
- global $wgEnableAutoRotation;
- if ( !$wgEnableAutoRotation ) {
+ if ( !BitmapHandler::autoRotateEnabled() ) {
return 0;
}