}
function initializeMultiPageXML() {
+ #
+ # Check for files uploaded prior to DJVU support activation
+ # They have a '0' in their metadata field.
+ #
if ( $this->metadata == '0' ) {
$deja = new DjVuImage( $this->imagePath );
$this->metadata = $deja->retrieveMetaData();
+ $this->purgeMetadataCache();
+
+ # Update metadata in the database
+ $dbw =& wfGetDB( DB_MASTER );
+ $dbw->update( 'image',
+ array( 'img_metadata' => $this->metadata ),
+ array( 'img_name' => $this->name ),
+ __METHOD__
+ );
}
$this->multiPageXML = new SimpleXMLElement( $this->metadata );
}
* Parse image options text and use it to make an image
*/
function makeImage( &$nt, $options ) {
- global $wgUseImageResize;
+ global $wgUseImageResize, $wgDjvuRenderer;
$align = '';
} elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) {
# remember to set an alignment, don't render immediately
$align = 'none';
- } elseif ( ! is_null( $match = $mwPage->matchVariableStartToEnd($val) ) ) {
+ } elseif ( isset( $wgDjvuRenderer ) && $wgDjvuRenderer
+ && ! is_null( $match = $mwPage->matchVariableStartToEnd($val) ) ) {
# Select a page in a multipage document
$page = $match;
} elseif ( $wgUseImageResize && ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {