Itemviewer Image Conversion

From DLXS Documentation

(Difference between revisions)
Jump to: navigation, search
Current revision (15:21, 30 September 2007) (edit) (undo)
 
Line 1: Line 1:
[[DLXS Wiki|Main Page]] > [[Mounting Collections: Class-specific Steps]] > [[Mounting a Text Class Collection]] > [[Newspaper Clip Image Access Mechanisms]] > Itemviewer Image Conversion
[[DLXS Wiki|Main Page]] > [[Mounting Collections: Class-specific Steps]] > [[Mounting a Text Class Collection]] > [[Newspaper Clip Image Access Mechanisms]] > Itemviewer Image Conversion
-
<h1><a name="GeneralInfo"></a>General Information</h1>
+
==General Information==
<p><span class="command">Itemview.pm</span> is a DLXS Perl class module,
<p><span class="command">Itemview.pm</span> is a DLXS Perl class module,
found in <span class="command">$DLXSROOT/lib</span>. It contains, among
found in <span class="command">$DLXSROOT/lib</span>. It contains, among
Line 9: Line 9:
and <span class="command">$DLXSROOT/cgi/t/text/ClipView.pm</span> are both
and <span class="command">$DLXSROOT/cgi/t/text/ClipView.pm</span> are both
subclasses of it, and so therefore inherit those methods.</p>
subclasses of it, and so therefore inherit those methods.</p>
-
<h1><a name="HandlerResolution" id="HandlerResolution"></a>Handler Resolution </h1>
+
 
 +
==Handler Resolution==
<p> After a <span class="command">Pageview</span> or <span class="command">ClipView</span> object
<p> After a <span class="command">Pageview</span> or <span class="command">ClipView</span> object
is instantiated, it contains information about every page in the
is instantiated, it contains information about every page in the
Line 19: Line 20:
which conversion &quot;helper&quot; program to use. </p>
which conversion &quot;helper&quot; program to use. </p>
-
<h1><a name="Scenarios" id="Scenarios"></a>Scenarios</h1>
+
==Scenarios==
<ul>
<ul>
<li>General information about scenarios</li>
<li>General information about scenarios</li>
Line 26: Line 27:
</ul>
</ul>
-
<h3>General information about scenarios</h3>
+
===General information about scenarios===
<p>In the running
<p>In the running
of <span class="command">pageviewer-idx</span> and its running
of <span class="command">pageviewer-idx</span> and its running
Line 43: Line 44:
would determine the proper method to invoke the conversion, which
would determine the proper method to invoke the conversion, which
is in turn coded to use a particular helper app. </p>
is in turn coded to use a particular helper app. </p>
-
<h3>Scenario 1: &quot;image&quot; requested</h3>
+
 
 +
===Scenario 1: &quot;image&quot; requested===
<p>Assume that the CGI requests &quot;image&quot;. First, the application
<p>Assume that the CGI requests &quot;image&quot;. First, the application
Line 69: Line 71:
is looked for. If there is a TIF file, available, then the <span class="command">TifTGifHandler</span> is
is looked for. If there is a TIF file, available, then the <span class="command">TifTGifHandler</span> is
called which in turn uses <span class="command">tif2web</span>.</p>
called which in turn uses <span class="command">tif2web</span>.</p>
-
<h3>Scenario 2: &quot;pdf&quot; requested</h3>
+
 
 +
===Scenario 2: &quot;pdf&quot; requested===
<p>Assume that the CGI requests &quot;pdf&quot;. First, the application
<p>Assume that the CGI requests &quot;pdf&quot;. First, the application
checks the <span class="command">%gStoredFilePriorityMap</span> hash
checks the <span class="command">%gStoredFilePriorityMap</span> hash

Current revision

Main Page > Mounting Collections: Class-specific Steps > Mounting a Text Class Collection > Newspaper Clip Image Access Mechanisms > Itemviewer Image Conversion

Contents

[edit] General Information

Itemview.pm is a DLXS Perl class module, found in $DLXSROOT/lib. It contains, among other things, the methods (handlers) that may invoke external image conversion programs. $DLXSROOT/cgi/t/text/PageView.pm and $DLXSROOT/cgi/t/text/ClipView.pm are both subclasses of it, and so therefore inherit those methods.

[edit] Handler Resolution

After a Pageview or ClipView object is instantiated, it contains information about every page in the document, including how many and what kinds of image files are stored for each page. Based on the CGI's request for a particular output format in which to view a page image (whether to retrieve and display a PDF or a GIF or a JPG file) and the types of file formats available for that page, the application object can determine which conversion "helper" program to use.

[edit] Scenarios

  • General information about scenarios
  • Scenario 1: "image" requested
  • Scenario 2: "pdf" requested

[edit] General information about scenarios

In the running of pageviewer-idx and its running of PVApp/CVApp, a PageView/ClipView object is instantiated. By using the Pageview/ArticleClips table in the dlxs database, and querying by the document's idno and the page's sequence number, the object is loaded up with all the page information necessary for a particular document. Therefore, it reflects every page and which file formats are stored on disk for each page.

PVApp/CVApp, invoked by pagevewer-idx and through its parent object, ItemViewApp, would look at the "stored image format" and the "requested image format", and using a hash found in $DLXSROOT/lib/ItemView.cfg, would determine the proper method to invoke the conversion, which is in turn coded to use a particular helper app.

[edit] Scenario 1: "image" requested

Assume that the CGI requests "image". First, the application checks the %gStoredFilePriorityMap hash in ItemView.cfg. This hash says that if the CGI is requesting an "image" file, the first file format to look for, stored on disk, is "jp2". If there is a JP2 file on disk, it will be used, then the Jp2ToJpgHandler would be used, which in turn, would use the helper app kdu_expand_jpg which is a wrapper script we provide to run kdu_expand_jpg with the proper parameters.

If there is no JP2 file on disk, the next file format to look for is "sid"; that is, MrSid. If there is a MrSid file on disk, then the SidToJpgHandler would be used, which in turn, would use the helper app mr_sid_retrieve.

If there is no MrSid file on disk, the next file format to look for is "jpg". If there is a JPG file on disk, then the requested and stored file formats match. Whenever this is the case, DeliverFileHandler is used, which simply copies the file from its storage location ($DLXSROOT/obj/... to the cached image directory $DLXSROOT/web/cache/...).

Finally, if there is no JPG file available on disk, a TIF file is looked for. If there is a TIF file, available, then the TifTGifHandler is called which in turn uses tif2web.

[edit] Scenario 2: "pdf" requested

Assume that the CGI requests "pdf". First, the application checks the %gStoredFilePriorityMap hash in ItemView.cfg. This hash says that if the CGI is requesting a pdf file, the first file format to look for (on disk, known via the Pageview database table and therefore via the PageView or ItemView object), is PDF.

If there is a PDF file, then the requested format matches the stored image format and the DeliverFileHandler method is called, which simply copies the file from its storage location ($DLXSROOT/obj/... to the cached image directory $DLXSROOT/web/cache/...).

If there is no PDF file stored, then the %gStoredFilePriorityMap says to look for a TIF file. If there is one stored, then the Tif2PdfHandler is called which in turn uses c42pdf.

Top

Personal tools