From: Daniel Kinzler Date: Tue, 29 Jun 2010 08:40:23 +0000 (+0000) Subject: added normalization for parameter 'page', based on pageCount, as by tims comment... X-Git-Tag: 1.31.0-rc.0~36350 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/?a=commitdiff_plain;h=3b4a75493df4c359a5e885ebbeeaa49c9b4ed638;p=lhc%2Fweb%2Fwiklou.git added normalization for parameter 'page', based on pageCount, as by tims comment to r68418 --- diff --git a/includes/media/Generic.php b/includes/media/Generic.php index 6f2230b38c..f53ad7bb02 100644 --- a/includes/media/Generic.php +++ b/includes/media/Generic.php @@ -357,9 +357,19 @@ abstract class ImageHandler extends MediaHandler { if ( !isset( $params['width'] ) ) { return false; } + if ( !isset( $params['page'] ) ) { $params['page'] = 1; + } else { + if ( $params['page'] > $image->pageCount() ) { + $params['page'] = $image->pageCount(); + } + + if ( $params['page'] < 1 ) { + $params['page'] = 1; + } } + $srcWidth = $image->getWidth( $params['page'] ); $srcHeight = $image->getHeight( $params['page'] ); if ( isset( $params['height'] ) && $params['height'] != -1 ) {