function controller_deepzoom($args, $output = "inline")
 {
     $response = $this->GetComponentResponse("./deepzoom.tpl");
     $response["args"] = $args;
     $response["imgname"] = any($args["img"], "webtrendsmap");
     $response["defaultlevel"] = any($args["defaultlevel"], 0);
     if (!empty($response["imgname"])) {
         $response["xmlpath"] = $this->imagedir . "/" . $response["imgname"] . ".xml";
         if (!empty($args["url"])) {
             $pinfo = pathinfo($args["url"]);
             $response["fileext"] = $pinfo["extension"];
             $response["filename"] = $response["imgname"] . "." . $response["fileext"];
             $response["filepath"] = $this->imagedir . "/originals/" . $response["filename"];
             if (!file_exists($response["filepath"])) {
                 print "Downloading file...";
                 flush();
                 $contents = file_get_contents($args["url"]);
                 if (!empty($contents)) {
                     file_put_contents($response["filepath"], $contents);
                 }
                 print "done.\n";
             }
             if (!file_exists($response["xmlpath"])) {
                 $converter = new Oz_Deepzoom_ImageCreator(256, 1, any($args["outputext"], $response["fileext"]));
                 $converter->create(realpath($response["filepath"]), $this->imagedir . '/' . $response["imgname"] . '.xml', true);
             }
         }
         if (file_exists($response["xmlpath"])) {
             $defaultdomain = "{random}.tiles2.supcrit.net";
             //$defaultdomain = "localhost";
             $img = new SimpleXMLElement(file_get_contents($response["xmlpath"]));
             if (!empty($img)) {
                 $response["fileext"] = (string) $img["Format"];
                 $response["imgdata"] = array("size" => array((int) $img->Size["Width"], (int) $img->Size["Height"]), "tilesize" => (int) $img["TileSize"], "overlap" => (int) $img["Overlap"], "url" => !empty($img["Url"]) ? (string) $img["Url"] : sprintf("http://%s/images/components/supercritical/deepzoom/%s_files/{level}/{column}_{row}.%s", $defaultdomain, $response["imgname"], $response["fileext"]));
             }
         }
     }
     //return $this->GetTemplate("./deepzoom.tpl", $vars);
     return $response;
 }
Example #2
0
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : NULL;
$w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : 0;
if (is_null($id)) {
    exit;
}
if (!defined('GLZ_LOADED')) {
    require_once 'core/core.inc.php';
    org_glizy_Paths::init('application', '');
    org_glizy_Config::init();
    if (file_exists(org_glizy_Paths::get('APPLICATION_STARTUP'))) {
        // if the startup folder is defined all files are included
        glz_require_once_dir(org_glizy_Paths::get('APPLICATION_STARTUP'));
    }
    org_glizy_ObjectValues::set('org.glizy', 'languageId', 1);
}
$zoomFile = __Paths::get('CACHE') . '/zoom_' . $id . '_' . $w . '.xml';
if (!file_exists($zoomFile)) {
    glz_import('org.glizycms.mediaArchive.MediaManager');
    set_time_limit(0);
    $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id);
    if (preg_match('/\\.tif$/', $media->fileName)) {
        $mediaInfo = $media->getResizeImage(2000, 2000);
        $media->fileName = $mediaInfo['fileName'];
    }
    set_include_path(implode(PATH_SEPARATOR, array(realpath('application/libs/openzoom/'), get_include_path())));
    require 'Oz/Deepzoom/ImageCreator.php';
    $converter = new Oz_Deepzoom_ImageCreator(254, 1, "jpg", 0.8);
    $converter->create(realpath($media->getFileName()), $zoomFile);
}
echo json_encode(true);
Example #3
0
<?php

/**
 * Exemple
 */
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath('../lib'), get_include_path())));
require 'Oz/Deepzoom/ImageCreator.php';
$converter = new Oz_Deepzoom_ImageCreator();
$converter->create(realpath('source/hlegius.jpg'), 'dest/hlegius.xml');
?>
<!DOCTYPE html>
<html>
    <head>
    	<!-- http://www.seadragon.com/developer/ajax/getting-started/ -->
        <script type="text/javascript" 
      	    src="http://seadragon.com/ajax/0.8/seadragon-min.js">
    	</script>
        <script type="text/javascript">
            var viewer = null;
            
            function init() {
                viewer = new Seadragon.Viewer("container");
                viewer.openDzi("dest/hlegius.xml");
            }
            
            Seadragon.Utils.addEvent(window, "load", init);
        </script>
        
        <style type="text/css">
            #container