MediaWiki  REL1_24
MockDjVuHandler.php
Go to the documentation of this file.
00001 <?php
00024 class MockDjVuHandler extends DjVuHandler {
00025     function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
00026         if ( !$this->normaliseParams( $image, $params ) ) {
00027             return new TransformParameterError( $params );
00028         }
00029         $width = $params['width'];
00030         $height = $params['height'];
00031         $page = $params['page'];
00032         if ( $page > $this->pageCount( $image ) ) {
00033             return new MediaTransformError(
00034                 'thumbnail_error',
00035                 $width,
00036                 $height,
00037                 wfMessage( 'djvu_page_error' )->text()
00038             );
00039         }
00040 
00041         $params = array(
00042             'width' => $width,
00043             'height' => $height,
00044             'page' => $page
00045         );
00046 
00047         return new ThumbnailImage( $image, $dstUrl, $dstPath, $params );
00048     }
00049 }