Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 53474df1ebe7a49e08105dd982ab359e8bc4532c Alan Stanley committed Sep 16, 2011
3 README
@@ -0,0 +1,3 @@
+Large Image Solution Pack for Islandora
+Load all required Fedora Objects, and creates empty collection object
+to accept tiff's and create deriviatives.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,8 @@
+; $Id$
+name = Islandora Large Image Solution Pack
+description = Islandora configurations for persisting and retrieving large images
+dependencies[] = fedora_repository
+
+package = Islandora
+version = 6.1dev
+core = 6.x
@@ -0,0 +1,90 @@
+<?php
+
+// $Id$
+
+
+function islandora_large_image_sp_required_fedora_objects() {
+
+
+ $module_path = drupal_get_path('module', 'islandora_large_image_sp');
+
+ // make database insertions here.
+
+
+ return array(
+ 'islandora_large_image_sp' => array(
+ 'module' => 'islandora_large_image_sp',
+ 'title' => 'Islandora Large image Solution Pack',
+ 'objects' => array(
+ array(
+ 'pid' => 'islandora:sp_large_image_cmodel',
+ 'label' => 'Islandora large image content model',
+ 'dsid' => 'ISLANDORACM',
+ 'datastream_file' => "$module_path/xml/islandora_sp_large_image_cmodel.xml",
+ 'cmodel' => 'fedora-system:ContentModel-3.0',
+ ),
+ array(
+ 'foxml_file' => "$module_path/xml/islandora_viewer_sdef.xml",
+ 'pid' => 'islandora:viewerSdef',
+ 'dsid' => NULL,
+ 'datastream_file' => NULL,
+ 'dsversion' => NULL,
+ ),
+ array(
+ 'foxml_file' => "$module_path/xml/islandora_viewer_sdep_large_image.xml",
+ 'pid' => 'islandora:viewerSdep-large_image_sp',
+ 'dsid' => NULL,
+ 'datastream_file' => NULL,
+ 'dsversion' => NULL,
+ ),
+ array(
+ 'foxml_file' => "$module_path/xml/islandora_jp2Sdef.xml",
+ 'pid' => 'islandora:jp2Sdef',
+ 'dsid' => NULL,
+ 'datastream_file' => NULL,
+ 'dsversion' => NULL,
+ ),
+ array(
+ 'foxml_file' => "$module_path/xml/islandora_jp2Sdep-large_image.xml",
+ 'pid' => 'islandora:jp2Sdep-large_image',
+ 'dsid' => NULL,
+ 'datastream_file' => NULL,
+ 'dsversion' => NULL,
+ ),
+ array(
+ 'foxml_file' => "$module_path/xml/islandora_mods2html_sdef.xml",
+ 'pid' => 'islandora:mods2htmlSdef',
+ 'dsid' => NULL,
+ 'datastream_file' => NULL,
+ 'dsversion' => NULL,
+ ),
+ array(
+ 'foxml_file' => "$module_path/xml/islandora_large_image_mods2htmlSdep.xml",
+ 'pid' => 'islandora:mods2htmlSdep-large_image',
+ 'dsid' => NULL,
+ 'datastream_file' => NULL,
+ 'dsversion' => NULL,
+ ),
+
+ array(
+ 'pid' => 'islandora:sp_large_image_collection',
+ 'label' => 'Islandora Large Image Collection',
+ 'cmodel' => 'islandora:collectionCModel',
+ 'parent' => 'islandora:top',
+ 'datastreams' => array(
+ array(
+ 'dsid' => 'TN',
+ 'datastream_file' => "$module_path/images/Crystal_Clear_filesystem_folder_grey.png",
+ 'mimetype' => 'image/png',
+ ),
+ array(
+ 'dsid' => 'COLLECTION_POLICY',
+ 'datastream_file' => "$module_path/xml/large_image_collection_policy.xml",
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+}
+
@@ -0,0 +1,122 @@
+
+<?php
+
+// $Id$
+
+/*
+ *
+ *
+ * This Class implements the methods defined in the basic image solution content model
+ */
+
+class LargeImageProcessor {
+
+ function LargeImageProcessor() {
+ module_load_include('inc', 'fedora_repository', 'ObjectHelper');
+ }
+
+ function createDerivatives($parameterArray = NULL, $dsid, $file, $file_ext) {
+ $file_suffix = "_$dsid.$file_ext";
+ $return_value = TRUE;
+
+ $output = array();
+
+ exec('kdu_compress -i "' . $file . '" -o "' . $file . $file_suffix . '" -rate 0.5 Clayers=1 Clevels=7 "Cprecincts={256,256},{256,256},{256,256},{128,128},{128,128},{64,64},{64,64},{32,32},{16,16}" "Corder=RPCL" "ORGgen_plt=yes" "ORGtparts=R" "Cblk={32,32}" Cuse_sop=yes', $output, $returnValue);
+
+ if ($returnValue == '0') {
+ $_SESSION['fedora_ingest_files'][$dsid] = $file . $file_suffix;
+ }
+ else {
+ ObjectHelper::warnIfMisconfigured('Kakadu');
+ }
+
+ exec('kdu_compress -i "' . $file . '" -o "' . $file . "_lossless.jp2" . '" -rate -,0.5 Clayers=2 Creversible=yes Clevels=8 "Cprecincts={256,256},{256,256},{128,128}" Corder="RPCL" ORGgen_plt="yes" ORGtparts="R" Cblk="{32,32}"', $output, $returnValue);
+ if ($returnValue == '0') {
+ $_SESSION['fedora_ingest_files']["LOSSLESS_JP2"] = $file . '_lossless.jp2';
+ }
+ else {
+ ObjectHelper::warnIfMisconfigured('Kakadu');
+ }
+ exec("convert -resize 800 \"{$file}\"[0] \"$file-med.jpg\"", $output, $returnValue);
+ if ($returnValue == '0') {
+ $_SESSION['fedora_ingest_files']["JPG"] = $file . '-med.jpg';
+ }
+ else {
+ ObjectHelper::warnIfMisconfigured('ImageMagick');
+ }
+ exec("convert {$file}[0] -thumbnail x2000 -thumbnail x450 -resize '450x<' -resize 50% -fuzz 1% -trim +repage -gravity center -crop 200x200+0+0 +repage -format jpg -quality 100 $file-tn.jpg", $output, $returnValue);
+ if ($returnValue == '0') {
+ $_SESSION['fedora_ingest_files']["TN"] = $file . '-tn.jpg';
+ }
+ else {
+ ObjectHelper::warnIfMisconfigured('ImageMagick');
+ }
+
+ if ($returnValue == '0') {
+ return TRUE;
+ }
+ else {
+
+ return $returnValue;
+ }
+ }
+
+}
+
+class ShowLargeImagesInFieldSets {
+
+ private $pid = NULL;
+
+ function ShowLargeImagesInFieldSets($pid) {
+ $this->pid = $pid;
+ }
+
+
+ function showJP2($collapsed = FALSE) {
+ $viewer_url = variable_get('fedora_base_url', '') . '/get/' . $this->pid . '/islandora:viewerSdef/getViewer';
+ $html = '<iframe src="' . $viewer_url . '" frameborder="0" style="width: 100%; height: 400px;">Errors: unable to load viewer</iframe>';
+ $fieldset = array(
+ '#title' => t('Viewer'),
+ '#collapsible' => TRUE,
+ '#collapsed' => $collapsed,
+ '#value' => $html
+ );
+ return theme('fieldset', $fieldset);
+ }
+ function showJPG() {
+ module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
+ module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets');
+ global $base_url;
+ global $user;
+
+ $tabset = array();
+
+ $qs = '';
+ if ($user->uid != 0) {
+ $qs = '?uid=' . base64_encode($user->name . ':' . $user->pass);
+ }
+
+ $viewer_url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/'. $this->pid . '/islandora:viewerSdef/getViewer'. $qs;
+ $html = '<iframe src="'. $viewer_url . '" scrolling="no" frameborder="0" style="width: 100%; height: 800px;">Errors: unable to load viewer</iframe>';
+
+ drupal_add_css(path_to_theme() . '/header-viewer.css', 'theme');
+
+ $tabset['second_tab'] = array(
+ '#type' => 'tabpage',
+ '#title' => t('Full-size'),
+ '#content' => $html);
+
+ $tabset['first_tab'] = array(
+ // #type and #title are the minimum requirements.
+ '#type' => 'tabpage',
+ '#title' => t('View'),
+ // This will be the content of the tab.
+ '#content' => '<img src="'. $base_url .
+ '/fedora/imageapi/'. $this->pid . '/JPG/JPG.jpg'. '" />'. '<p>'. drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>',
+ );
+
+ return $tabset;
+ }
+
+
+}
Oops, something went wrong.

0 comments on commit 53474df

Please sign in to comment.