mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler
synced 2024-11-27 17:50:47 +00:00
* Fix to be conform with latest changes to MediaTransformOutput
* Add i18n file Patch by xaras and /me
This commit is contained in:
parent
67c1d72dee
commit
1d6efbd9a5
|
@ -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
21
PdfHandler_i18n.php
Normal 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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue