}
var options = 'id=' + this.bookId + '&server=' + this.server + '&zip=' + this.zip
- + '&format=' + this.imageFormat + '&index=' + this.leafMap[indexToPrint]
+ + '&format=' + this.imageFormat + '&file=' + this._getPageFile(indexToPrint)
+ '&width=' + this.getPageWidth(indexToPrint) + '&height=' + this.getPageHeight(indexToPrint);
if (this.constMode2up == this.mode) {
- options += '&index2=' + this.leafMap[this.twoPage.currentIndexR] + '&width2=' + this.getPageWidth(this.twoPage.currentIndexR);
+ options += '&file2=' + this._getPageFile(this.twoPage.currentIndexR) + '&width2=' + this.getPageWidth(this.twoPage.currentIndexR);
options += '&height2=' + this.getPageHeight(this.twoPage.currentIndexR);
options += '&title=' + escape(this.shortTitle(30) + ' - Pages ' + this.getPageNum(this.twoPage.currentIndexL) + ', ' + this.getPageNum(this.twoPage.currentIndexR));
} else {
_rotate = rotate;
}
- var leafStr = '0000';
- var imgStr = this.leafMap[index].toString();
- var re = new RegExp("0{"+imgStr.length+"}$");
-
- var insideZipPrefix = this.subPrefix.match('[^/]+$');
- var file = insideZipPrefix + '_' + this.imageFormat + '/' + insideZipPrefix + '_' + leafStr.replace(re, imgStr) + '.' + this.imageFormat;
-
+ var file = this._getPageFile(index);
+
// $$$ add more image stack formats here
if (1==this.mode) {
var url = 'http://'+this.server+'/GnuBook/GnuBookImages.php?zip='+this.zip+'&file='+file+'&scale='+_reduce+'&rotate='+_rotate;
return url;
}
+gb._getPageFile = function(index) {
+ var leafStr = '0000';
+ var imgStr = this.leafMap[index].toString();
+ var re = new RegExp("0{"+imgStr.length+"}$");
+
+ var insideZipPrefix = this.subPrefix.match('[^/]+$');
+ var file = insideZipPrefix + '_' + this.imageFormat + '/' + insideZipPrefix + '_' + leafStr.replace(re, imgStr) + '.' + this.imageFormat;
+
+ return file;
+}
+
gb.getPageSide = function(index) {
//assume the book starts with a cover (right-hand leaf)
//we should really get handside from scandata.xml
<? // Use special function if we should infer the page sides based off the title page index
if (preg_match('/goog$/', $id) && ('' != $titleLeaf)) {
?>
- // assume page side based on title page
+ // assume page side based on title pagex
var titleIndex = gb.leafNumToIndex(gb.titleLeaf);
// assume title page is RHS
var delta = titleIndex - index;
$id = $_REQUEST['id'];
$server = $_REQUEST['server'];
$zip = $_REQUEST['zip'];
-$index = $_REQUEST['index'];
+$file = $_REQUEST['file'];
$format = $_REQUEST['format'];
//$imgAspect = $_REQUEST['aspect'];
$width = floatval($_REQUEST['width']);
$allowRotate = true;
// Returns (url, attrs)
-function imageURL($paperAspect, $index, $format, $width, $height, $allowRotate) {
+function imageURL($paperAspect, $file, $format, $width, $height, $allowRotate) {
global $server, $id, $zip;
$rotate = "0";
// taller than paper, fit height
$htmlAttrs = "height='95%'";
}
-
- $file = sprintf("%s_%s/%s_%04d.%s", $id, $format, $id, $index, $format);
$queryParams = array(
'id' => $id, // global
echo "<p class='noprint' style='text-align: right'>";
echo "<button class='GBicon rollover print' title='Print' onclick='print(); return false;'></button> <a href='#' onclick='print(); return false;'>Print</a></p>";
echo "<p style='text-align:center;'>";
-echo imageURL($paperAspect, $index, $format, $width, $height, $allowRotate);
+echo imageURL($paperAspect, $file, $format, $width, $height, $allowRotate);
echo "</p>";
-if (isset($_REQUEST['index2'])) {
- $index2 = $_REQUEST['index2'];
+if (isset($_REQUEST['file2'])) {
+ $file2 = $_REQUEST['file2'];
$width2 = floatval($_REQUEST['width2']);
$height2 = floatval($_REQUEST['height2']);
echo "<p style='text-align: center;'>";
- echo imageURL($paperAspect, $index2, $format, $width2, $height2, $allowRotate);
+ echo imageURL($paperAspect, $file2, $format, $width2, $height2, $allowRotate);
echo "</p>";
}
echo "</body></html>";