From: Vivek Ghaisas Date: Thu, 25 Dec 2014 08:52:12 +0000 (+0300) Subject: UnregisteredLocalFile.php: Override File::getBitDepth() stub X-Git-Tag: 1.31.0-rc.0~12421^2 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=0e51891e083b53dd66fa787d83ab7b77225d55e5;p=lhc%2Fweb%2Fwiklou.git UnregisteredLocalFile.php: Override File::getBitDepth() stub The File::getBitDepth() stub simply returns 0 and UnregisteredLocalFile was not overriding this to return the actual bit depth. UnregisteredLocalFile::getBitDepth() now handles this by returning the 'bits' field of $this->getImageSize(). This commit just fixes the above bug, but some rethinking of the structure and behaviour of this class and the UploadStashFile class is required. Bug: T36952 Change-Id: I4a8fd6b74b923f2052ccd2e47980486299ad2a6e --- diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index 5a3e4e9c77..4c11341b1d 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -165,6 +165,18 @@ class UnregisteredLocalFile extends File { return $this->handler->getImageSize( $this, $this->getLocalRefPath() ); } + /** + * @return int + */ + function getBitDepth() { + $gis = $this->getImageSize( $this->getLocalRefPath() ); + + if ( !$gis || !isset( $gis['bits'] ) ) { + return 0; + } + return $gis['bits']; + } + /** * @return bool */