\n"; print "\n"; print "\n";} else {print ">\n";} print "Show Page Images | \n"; print "\n";} else {print ">\n";} print "Show Diplomatic | \n"; print "\n";} else {print ">\n";} print "Show Standardized | \n"; #if ($scale) {print "\n";} else {print "
\n"; print "\n"; } function show_image() { global $thumb_threshhold; # Optional hard-coded variable definitions # How many pages in doc before switching to link-only mode $thumb_threshhold = 1; $file = $_GET['file']; #$file = "1697.0703.Fa.djvu"; #$file = "54-native-land.djvu"; $document = preg_replace("/\.djvu/","",$file); $title = "Document Number: " . $document; $display = $_GET['display']; $scale = $_REQUEST['scale']; $page = $_GET['page']; if ($display) {show_jpg();} else {show_page();} } # end image_display function # Begin Functions function show_jpg() { global $file,$scale,$initial_view,$page,$title,$SCRIPT_NAME; $file = $_GET['file']; $djvu_file = $file; $thumbnail_scale = "2"; $initial_view = "25%"; #$temp_directory = "/Users/millarj/Sites/prior/letters/temp"; $temp_directory = "/tmp"; $thumbnail_size = "75"; srand((double)microtime()*1000000); $rndstem = rand(1,10000); #if ($scale) {$options = " -scale $scale" . "%";} else {$options = " -size $thumbnail_size"."x"."$thumbnail_size";} if ($scale) {$options = " -scale $scale" . "%";} else {$options = " -scale 15%";} if ($page) {$options = " -page $page" . $options;} $exec_command = "/usr/bin/ddjvu $options $djvu_file $temp_directory/$rndstem.tiff"; $exec2_command = "convert $temp_directory/$rndstem.tiff $temp_directory/$rndstem.jpg"; exec($exec_command); exec($exec2_command); header("Content-type: image/jpeg"); header("Content-disposition: attachment: filename=image.jpg"); readfile("/tmp/$rndstem.jpg"); #print "\n"; #unlink("/tmp/$rndstem.jpg"); } function show_page() { global $file,$scale,$title,$page,$pages,$thumbnail_scale,$thumbs,$SCRIPT_NAME,$thumb_threshhold, $xml,$mode; $file = $_GET['file']; if (!$scale) {$scale = "15";} if (!$page) {$page = "1";} get_num_pages(); $encoded_title = urlencode($title); $decoded_title = urldecode($title); print "\n"; } function show_diplomatic_transcript() { global $file; $file = $_GET['file']; print "\n"; } function footer() { print "
\n"; for ($i = 1; $i <= $pages; $i++) { print "\n"; if ($thumb_threshhold > $pages) { print "
\n"; print "
Page $i

\n"; } else { print "Page $i

\n"; } $page_array[$i] = ""; } print "

$decoded_title
\"$title\"
\n"; $scales = array ( "25" => "", "50" => "", "75" => "", "100" => "", "150" => "", "200" => "", "300" => "" ); $scales[$scale] = "selected"; print "\n"; $page_array[$page] = "selected"; print "

\n"; if ($file == '1709.1127.Fa.djvu') {print "Image used by permission: Robert H. Taylor Collection. Department of Rare Books and Special Collections. Princeton University Library\n";} if ($file == '1718.0301.Fa.djvu') {print "Image used by the kind permission of the Syndics of the Fitzwilliam Museum, Cambridge\n";} if ($file == '1697.0703.Fa.djvu') {print "Prior Manuscript Letters, by permission of The Walter Havighurst Special Collections, Miami University Libraries, Ohio\n";} if ($file == '1698.0829.Fa.djvu') {print "Prior Manuscript Letters, by permission of The Walter Havighurst Special Collections, Miami University Libraries, Ohio\n";} if ($file == '1703.1120.Fa.djvu') {print "Prior Manuscript Letters, by permission of The Walter Havighurst Special Collections, Miami University Libraries, Ohio\n";} if ($file == '1704.0122.Fa.djvu') {print "Prior Manuscript Letters, by permission of The Walter Havighurst Special Collections, Miami University Libraries, Ohio\n";} } function get_num_pages() { global $file,$pages; $file = $_GET['file']; $pages_exec = "/usr/bin/djvudump $file |grep INFO |wc -l"; $pages = exec("$pages_exec"); #print "Pages1 = $pages\n"; } function show_standard_transcript() { global $file; print "

Standardized Transcript

"; $file = $_GET['file']; $standard_file = preg_replace("/.djvu/", ".standard.html", $file); require($standard_file); print "

Diplomatic Transcript

"; $diplomatic_file = preg_replace("/.djvu/", ".diplomatic.html", $file); require($diplomatic_file); print "

Based on: \"DejaView\" © 2003, John Millard\n"; } #function get_num_pages() #{ #global $file,$pages; #$pages_exec = "/usr/bin/djvudump $file |grep INFO |wc -l"; #$pages = exec("$pages_exec"); #print "Pages1 = $pages\n"; #} # Assemble register_settings(); html_header(); if ($imageoption == "yes") {show_image();} if ($_REQUEST[diplomatic] == "yes") {show_diplomatic_transcript();} if ($_REQUEST[standard] == "yes") {show_standard_transcript();} #phpinfo(); footer(); ?>