* @ingroup Media
*/
abstract class ImageHandler extends MediaHandler {
-
/**
* @param $file File
* @return bool
} else {
throw new MWException( 'No width specified to ' . __METHOD__ );
}
+
# Removed for ProofreadPage
#$width = intval( $width );
return "{$width}px";
}
if ( !$this->validateThumbParams( $params['physicalWidth'],
- $params['physicalHeight'], $srcWidth, $srcHeight, $mimeType ) ) {
+ $params['physicalHeight'], $srcWidth, $srcHeight, $mimeType )
+ ) {
return false;
}
+
return true;
}
# Sanity check $width
if ( $width <= 0 ) {
wfDebug( __METHOD__ . ": Invalid destination width: $width\n" );
+
return false;
}
if ( $srcWidth <= 0 ) {
wfDebug( __METHOD__ . ": Invalid source width: $srcWidth\n" );
+
return false;
}
# Force height to be at least 1 pixel
$height = 1;
}
+
return true;
}
wfSuppressWarnings();
$gis = getimagesize( $path );
wfRestoreWarnings();
+
return $gis;
}
+
/**
* Function that returns the number of pixels to be thumbnailed.
* Intended for animated GIFs to multiply by the number of frames.
function getShortDesc( $file ) {
global $wgLang;
$nbytes = htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
- $widthheight = wfMessage( 'widthheight' )->numParams( $file->getWidth(), $file->getHeight() )->escaped();
+ $widthheight = wfMessage( 'widthheight' )
+ ->numParams( $file->getWidth(), $file->getHeight() )->escaped();
return "$widthheight ($nbytes)";
}
if ( $pages === false || $pages <= 1 ) {
$msg = wfMessage( 'file-info-size' )->numParams( $file->getWidth(),
$file->getHeight() )->params( $size,
- $file->getMimeType() )->parse();
+ $file->getMimeType() )->parse();
} else {
$msg = wfMessage( 'file-info-size-pages' )->numParams( $file->getWidth(),
$file->getHeight() )->params( $size,
- $file->getMimeType() )->numParams( $pages )->parse();
+ $file->getMimeType() )->numParams( $pages )->parse();
}
+
return $msg;
}
function getDimensionsString( $file ) {
$pages = $file->pageCount();
if ( $pages > 1 ) {
- return wfMessage( 'widthheightpage' )->numParams( $file->getWidth(), $file->getHeight(), $pages )->text();
+ return wfMessage( 'widthheightpage' )
+ ->numParams( $file->getWidth(), $file->getHeight(), $pages )->text();
} else {
- return wfMessage( 'widthheight' )->numParams( $file->getWidth(), $file->getHeight() )->text();
+ return wfMessage( 'widthheight' )
+ ->numParams( $file->getWidth(), $file->getHeight() )->text();
}
}
}