projects
/
bookreader.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9a9f846
)
Change to class static variables
author
Michael Ang
<mang@archive.org>
Tue, 27 Jul 2010 01:07:44 +0000
(
01:07
+0000)
committer
Michael Ang
<mang@archive.org>
Tue, 27 Jul 2010 01:07:44 +0000
(
01:07
+0000)
BookReaderIA/datanode/BookReaderImages.inc.php
patch
|
blob
|
history
diff --git
a/BookReaderIA/datanode/BookReaderImages.inc.php
b/BookReaderIA/datanode/BookReaderImages.inc.php
index
4933999
..
9d2f45e
100644
(file)
--- a/
BookReaderIA/datanode/BookReaderImages.inc.php
+++ b/
BookReaderIA/datanode/BookReaderImages.inc.php
@@
-28,7
+28,7
@@
require_once("BookReaderMeta.inc.php");
class BookReaderImages
{
class BookReaderImages
{
- public $MIMES = array('gif' => 'image/gif',
+ public
static
$MIMES = array('gif' => 'image/gif',
'jp2' => 'image/jp2',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jp2' => 'image/jp2',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
@@
-36,7
+36,7
@@
class BookReaderImages
'tif' => 'image/tiff',
'tiff' => 'image/tiff');
'tif' => 'image/tiff',
'tiff' => 'image/tiff');
- public $EXTENSIONS = array('gif' => 'gif',
+ public
static
$EXTENSIONS = array('gif' => 'gif',
'jp2' => 'jp2',
'jpeg' => 'jpeg',
'jpg' => 'jpeg',
'jp2' => 'jp2',
'jpeg' => 'jpeg',
'jpg' => 'jpeg',
@@
-45,13
+45,24
@@
class BookReaderImages
'tiff' => 'tiff');
// Width when generating thumbnails
'tiff' => 'tiff');
// Width when generating thumbnails
- public $imageSizes = array(
+ public
static
$imageSizes = array(
'thumb' => 100,
'thumb' => 100,
- 'small' => 240,
- 'medium' => 500,
- 'large' => 1024,
+ 'small' => 256,
+ 'medium' => 512,
+ 'large' => 2048,
+ );
+
+ // Keys in the image permalink urls, e.g. http://www.archive.org/download/itemid/page/cover_{keyval}_{keyval}.jpg
+ public static $imageUrlKeys = array(
+ 'r' => 'reduce',
+ 's' => 'scale',
+ 'region' => 'region',
+ 'tile' => 'tile',
+ 'w' => 'width',
+ 'h' => 'height'
);
);
+
// Paths to command-line tools
var $exiftool = '/petabox/sw/books/exiftool/exiftool';
var $kduExpand = '/petabox/sw/bin/kdu_expand';
// Paths to command-line tools
var $exiftool = '/petabox/sw/books/exiftool/exiftool';
var $kduExpand = '/petabox/sw/bin/kdu_expand';
@@
-341,7
+352,7
@@
class BookReaderImages
$filenameForClient = $this->filenameForClient($file, $ext);
$filenameForClient = $this->filenameForClient($file, $ext);
- $headers = array('Content-type: '.
$MIMES[$ext], // XXX is nginx swallowing this?
+ $headers = array('Content-type: '.
self::$MIMES[$ext],
'Cache-Control: max-age=15552000',
'Content-disposition: inline; filename=' . $filenameForClient);
'Cache-Control: max-age=15552000',
'Content-disposition: inline; filename=' . $filenameForClient);
@@
-413,8
+424,8
@@
class BookReaderImages
function imageExtensionToType($extension)
{
function imageExtensionToType($extension)
{
- if (array_key_exists($extension,
$this->
EXTENSIONS)) {
- return
$this->
EXTENSIONS[$extension];
+ if (array_key_exists($extension,
self::$
EXTENSIONS)) {
+ return
self::$
EXTENSIONS[$extension];
} else {
$this->BRfatal('Unknown image extension');
}
} else {
$this->BRfatal('Unknown image extension');
}
@@
-757,19
+768,6
@@
class BookReaderImages
'title' => 'single'
);
'title' => 'single'
);
- $sizes = array(
- 'large', 'thumb', 'medium', 'small', 'orig'
- );
-
- $keys = array(
- 'r' => 'reduce',
- 's' => 'scale',
- 'region' => 'region',
- 'tile' => 'tile',
- 'w' => 'width',
- 'h' => 'height'
- );
-
// Look for known page types
foreach ( $pageTypes as $pageName => $kind ) {
if ( preg_match('#^(' . $pageName . ')(.*)#', $page, $matches) === 1 ) {
// Look for known page types
foreach ( $pageTypes as $pageName => $kind ) {
if ( preg_match('#^(' . $pageName . ')(.*)#', $page, $matches) === 1 ) {
@@
-793,7
+791,7
@@
class BookReaderImages
// Look for other known parts
foreach ($parts as $part) {
// Look for other known parts
foreach ($parts as $part) {
- if ( in_array($part, $
s
izes) ) {
+ if ( in_array($part, $
imageS
izes) ) {
$pageInfo['size'] = $part;
continue;
}
$pageInfo['size'] = $part;
continue;
}
@@
-808,8
+806,8
@@
class BookReaderImages
$key = $matches[1];
$value = $matches[2];
$key = $matches[1];
$value = $matches[2];
- if ( array_key_exists($key,
$k
eys) ) {
- $pageInfo[
$k
eys[$key]] = $value;
+ if ( array_key_exists($key,
self::$imageUrlK
eys) ) {
+ $pageInfo[
self::$imageUrlK
eys[$key]] = $value;
continue;
}
continue;
}