* Fix to be conform with latest changes to MediaTransformOutput

* Add i18n file
Patch by xaras and /me
This commit is contained in:
Raimond Spekking 2007-09-05 20:58:23 +00:00
parent 67c1d72dee
commit 1d6efbd9a5
3 changed files with 43 additions and 5 deletions

View file

@ -103,10 +103,8 @@ class PdfHandler extends ImageHandler {
wfMsg( 'pdf_page_error' ) );
if ( $flags & self::TRANSFORM_LATER )
return new ThumbnailImage( $dstUrl,
$width,
$height,
$dstPath );
return new ThumbnailImage( $image, $dstUrl, $width,
$height, $dstPath, $page );
if ( !wfMkdirParents( dirname( $dstPath ) ) )
return new MediaTransformError( 'thumbnail_error',
@ -134,7 +132,7 @@ class PdfHandler extends ImageHandler {
wfHostname(), $retval, trim($err), $cmd ) );
return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
} else {
return new ThumbnailImage( $dstUrl, $width, $height, $dstPath );
return new ThumbnailImage( $image, $dstUrl, $width, $height, $dstPath, $page );
}
}

21
PdfHandler_i18n.php Normal file
View file

@ -0,0 +1,21 @@
<?php
/**
* Internationalisation file for PDFHandler extension
*/
function efPdfHandlerMessages() {
$messages = array(
'en' => array(
'pdf_no_xml' => 'cannot get metadata from pdf',
'pdf_page_error' => 'page number not in range',
),
'de' => array(
'pdf_no_xml' => 'Keine Metadaten im PDF vorhanden.',
'pdf_page_error' => 'Seitenzahl außerhalb des Dokumentes.',
),
);
return $messages;
}

View file

@ -40,3 +40,22 @@
$wgAutoloadClasses['PdfImage'] = dirname(__FILE__) . '/PdfImage.php';
$wgAutoloadClasses['PdfHandler'] = dirname(__FILE__) . '/PdfHandler.php';
$wgMediaHandlers['application/pdf'] = 'PdfHandler';
$wgExtensionFunctions[] = 'wfPdfHandlerLoadMessages';
/* load messages */
function wfPdfHandlerLoadMessages() {
global $wgMessageCache;
static $msgLoaded = false;
if ( $msgLoaded )
return false;
$msgLoaded = true;
require( dirname( __FILE__ ) . '/PdfHandler_i18n.php' );
foreach ( efPdfHandlerMessages() as $lang => $messagesForLang ) {
$wgMessageCache->addMessages( $messagesForLang, $lang );
}
return true;
}