MediaWiki  master
DjVuImage Class Reference

Support for detecting/validating DjVu image files and getting some basic file metadata (resolution etc) More...

Public Member Functions

 __construct ( $filename)
 
 dump ()
 For debugging; dump the IFF chunk structure. More...
 
 getImageSize ()
 Return width and height. More...
 
 isValid ()
 Check if the given file is indeed a valid DjVu image file. More...
 
 retrieveMetaData ()
 Return an array describing the DjVu image. More...
 

Private Member Functions

 convertDumpToJSON ( $dump)
 
 dumpForm ( $file, $length, $indent)
 
 getInfo ()
 
 getMultiPageInfo ( $file, $formLength)
 
 getPageInfo ( $file)
 
 pageTextCallback (string $match)
 
 parseFormDjvu ( $line)
 
 readChunk ( $file)
 
 skipChunk ( $file, $chunkLength)
 

Private Attributes

string $mFilename
 
const DJVUTXT_MEMORY_LIMIT = 300000000
 Memory limit for the DjVu description software. More...
 

Detailed Description

Support for detecting/validating DjVu image files and getting some basic file metadata (resolution etc)

File format docs are available in source package for DjVuLibre: http://djvulibre.djvuzone.org/

Definition at line 39 of file DjVuImage.php.

Constructor & Destructor Documentation

◆ __construct()

DjVuImage::__construct (   $filename)
Parameters
string$filenameThe DjVu file name.

Definition at line 52 of file DjVuImage.php.

Member Function Documentation

◆ convertDumpToJSON()

DjVuImage::convertDumpToJSON (   $dump)
private
Parameters
string$dump
Returns
array|false

Definition at line 313 of file DjVuImage.php.

References $line, parseFormDjvu(), and wfDebug().

Referenced by retrieveMetaData().

◆ dump()

DjVuImage::dump ( )

For debugging; dump the IFF chunk structure.

Definition at line 88 of file DjVuImage.php.

References $file, $header, and dumpForm().

◆ dumpForm()

DjVuImage::dumpForm (   $file,
  $length,
  $indent 
)
private

Definition at line 99 of file DjVuImage.php.

References $file.

Referenced by dump().

◆ getImageSize()

DjVuImage::getImageSize ( )

Return width and height.

Returns
array An array with "width" and "height" keys, or an empty array on failure.

Definition at line 70 of file DjVuImage.php.

References getInfo().

◆ getInfo()

DjVuImage::getInfo ( )
private

Definition at line 125 of file DjVuImage.php.

References $file, $header, getMultiPageInfo(), getPageInfo(), and wfDebug().

Referenced by getImageSize(), and isValid().

◆ getMultiPageInfo()

DjVuImage::getMultiPageInfo (   $file,
  $formLength 
)
private

Definition at line 181 of file DjVuImage.php.

References $file, getPageInfo(), readChunk(), skipChunk(), and wfDebug().

Referenced by getInfo().

◆ getPageInfo()

DjVuImage::getPageInfo (   $file)
private

Definition at line 210 of file DjVuImage.php.

References $file, readChunk(), and wfDebug().

Referenced by getInfo(), and getMultiPageInfo().

◆ isValid()

DjVuImage::isValid ( )

Check if the given file is indeed a valid DjVu image file.

Returns
bool

Definition at line 60 of file DjVuImage.php.

References getInfo().

Referenced by retrieveMetaData().

◆ pageTextCallback()

DjVuImage::pageTextCallback ( string  $match)
private

Definition at line 302 of file DjVuImage.php.

◆ parseFormDjvu()

DjVuImage::parseFormDjvu (   $line)
private

Definition at line 371 of file DjVuImage.php.

References $line.

Referenced by convertDumpToJSON().

◆ readChunk()

DjVuImage::readChunk (   $file)
private

Definition at line 161 of file DjVuImage.php.

References $file, and $header.

Referenced by getMultiPageInfo(), and getPageInfo().

◆ retrieveMetaData()

DjVuImage::retrieveMetaData ( )

Return an array describing the DjVu image.

Returns
array|null|false

Definition at line 252 of file DjVuImage.php.

References $matches, convertDumpToJSON(), isValid(), wfDebug(), and wfShellExec().

◆ skipChunk()

DjVuImage::skipChunk (   $file,
  $chunkLength 
)
private

Definition at line 172 of file DjVuImage.php.

References $file.

Referenced by getMultiPageInfo().

Member Data Documentation

◆ $mFilename

string DjVuImage::$mFilename
private

Definition at line 47 of file DjVuImage.php.

◆ DJVUTXT_MEMORY_LIMIT

const DjVuImage::DJVUTXT_MEMORY_LIMIT = 300000000
private

Memory limit for the DjVu description software.

Definition at line 44 of file DjVuImage.php.


The documentation for this class was generated from the following file: