if ( $mime ) {
$this->mime = $mime;
}
- $this->dims = array();
+ $this->dims = [];
}
/**
* @return bool
*/
private function cachePageDimensions( $page = 1 ) {
+ $page = (int)$page;
+ if ( $page < 1 ) {
+ $page = 1;
+ }
+
if ( !isset( $this->dims[$page] ) ) {
if ( !$this->getHandler() ) {
return false;
*/
function getMimeType() {
if ( !isset( $this->mime ) ) {
- $magic = MimeMagic::singleton();
+ $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
$this->mime = $magic->guessMimeType( $this->getLocalRefPath() );
}
}
/**
- * @return int
- */
+ * @return int
+ */
function getBitDepth() {
$gis = $this->getImageSize( $this->getLocalRefPath() );