From 27624af90a66340aac3f90cc5a035efdb280121d Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Sun, 13 Aug 2006 21:09:20 +0000 Subject: [PATCH] DJVU rendering: Handle old DB metadata entries --- includes/Image.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/Image.php b/includes/Image.php index 743e1b82f9..f329fedd92 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -2257,13 +2257,21 @@ class Image $this->load(); } if ( ! isset( $this->multiPageXML ) ) { - $this->multiPageXML = new SimpleXMLElement( $this->metadata ); + $this->initializeMultiPageXML(); } $o = $this->multiPageXML->BODY[0]->OBJECT[$page-1]; $this->height = intval( $o['height'] ); $this->width = intval( $o['width'] ); } + function initializeMultiPageXML() { + if ( $this->metadata == '0' ) { + $deja = new DjVuImage( $this->imagePath ); + $this->metadata = $deja->retrieveMetaData(); + } + $this->multiPageXML = new SimpleXMLElement( $this->metadata ); + } + /** * Returns 'true' if this image is a multipage document, e.g. a DJVU * document. @@ -2283,7 +2291,7 @@ class Image return null; } if ( ! isset( $this->multiPageXML ) ) { - $this->multiPageXML = new SimpleXMLElement( $this->metadata ); + $this->initializeMultiPageXML(); } return count( $this->multiPageXML->xpath( '//OBJECT' ) ); } -- 2.20.1