/** * This file is part of the GLIZY framework. * Copyright (c) 2005-2012 Daniele Ugoletti <*****@*****.**> * * For the full copyright and license information, please view the COPYRIGHT.txt * file that was distributed with this source code. */ function getImage($applicationPath, $corePath = '') { require_once $corePath . 'core/core.inc.php'; org_glizy_Paths::init($applicationPath, $corePath); org_glizy_Config::init(); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : NULL; $w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : NULL; $h = isset($_REQUEST['h']) ? intval($_REQUEST['h']) : NULL; $force = isset($_REQUEST['f']) ? $_REQUEST['f'] == 'true' || $_REQUEST['f'] == '1' : false; $crop = isset($_REQUEST['c']) ? $_REQUEST['c'] == 'true' || $_REQUEST['c'] == '1' : false; if (is_null($id)) { exit; } glz_import('org.glizycms.mediaArchive.MediaManager'); $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id); if ($media->type != 'IMAGE') { exit; } if (!is_null($w) && !is_null($h)) { //resize the image $mediaInfo = $media->getResizeImage($w, $h, $crop, 0, $force); } else { // get the full image $mediaInfo = $media->getImageInfo(); } $ext = array(IMG_GIF => '.gif', IMG_JPG => '.jpeg', IMG_PNG => '.png', IMG_WBMP => '.wbmp'); header("location: " . GLZ_HOST . '/' . $mediaInfo['fileName']); }
public function publish() { $exportPath = __Paths::get('CACHE') . 'export/'; $mediaPath = $exportPath . 'media/'; $zipPath = __Paths::get('BASE') . 'export/' . 'mobileContents.zip'; org_glizy_helpers_Files::deleteDirectory($exportPath); @unlink($zipPath); @mkdir($exportPath); @mkdir($mediaPath); $exportService = org_glizy_ObjectFactory::createObject('movio.modules.publishApp.service.ExportService'); $exportService->export(); $medias = $exportService->getMedias(); foreach ($medias as $id => $fileName) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id); copy($media->getFileName(), $mediaPath . $fileName); } $dbHost = __Config::get('DB_HOST'); $dbUser = __Config::get('DB_USER'); $dbPass = __Config::get('DB_PSW'); $dbName = __Config::get('DB_NAME'); $tableName = __Config::get('movio.modules.publishApp.mobileContentsTable'); $sqliteDb = $exportPath . __Config::get('movio.modules.publishApp.sqliteDbName'); $mysql2SqliteService = org_glizy_ObjectFactory::createObject('movio.modules.publishApp.service.Mysql2SqliteService'); $mysql2SqliteService->convert($dbHost, $dbUser, $dbPass, $dbName, $tableName, $sqliteDb); $this->createZip($exportPath, $zipPath); org_glizy_Registry::set('movio/modules/publishApp/lastUpdate', time()); }
public static function getFileUrlById($id, $direct = false) { if ($direct) { $media =& org_glizycms_mediaArchive_MediaManager::getMediaById($id); return is_null($media) ? '' : $media->getFileName(false); } else { return org_glizycms_Glizycms::getMediaArchiveBridge()->getMediaById($id); } }
public function deleteMedia($id) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id); if (!$media->isMapped()) { $fileName = $media->getFileName(); if (file_exists($fileName) && $media->getIconFileName() != $fileName) { unlink($fileName); } } $media->ar->delete($id); if (__Config::get('glizycms.mediaArchive.exifEnabled')) { $exifService = org_glizy_ObjectFactory::createObject('org.glizycms.mediaArchive.services.ExifService'); $exifService->delete($id); } }
function execute($mediaPath, $languageId, $languageCode, $menuIdArray, $title, $subtitle, $creditPageId, $isExhibitionActive) { if ($this->user->isLogged()) { $mobileContentsTable = __Config::get('movio.modules.publishApp.mobileContentsTable'); org_glizy_dataAccessDoctrine_DataAccess::truncateTable($mobileContentsTable); $mobileFulltextTable = __Config::get('movio.modules.publishApp.mobileFulltextTable'); org_glizy_dataAccessDoctrine_DataAccess::truncateTable($mobileFulltextTable); $exportService = org_glizy_ObjectFactory::createObject('movio.modules.publishApp.service.ExportService'); $exportService->export($languageId, $languageCode, $menuIdArray, $title, $subtitle, $creditPageId, $isExhibitionActive); $medias = $exportService->getMedias(); foreach ($medias as $id => $fileName) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id); @copy($media->getFileName(), $mediaPath . $fileName); } return $exportService->getGraphs(); } }
private function addLogoAndCustomCss(&$templateData, $css) { $templateData->headerLogo = @json_decode($templateData->headerLogo); if ($templateData->headerLogo) { $image = org_glizycms_mediaArchive_MediaManager::getMediaById($templateData->headerLogo->id); $fileName = $image->getFileName(); $sizes = $image->getOriginalSizes(); $templateData->customCss .= <<<EOD header .site-logo { background: url("../{$fileName}") no-repeat ; width: {$sizes['width']}px; height: {$sizes['height']}px; } EOD; } $css .= PHP_EOL . $templateData->customCss; return $css; }
function mediaAbsoluteUrl($item, $field) { $json = $item->{$field}; if (preg_match('/{"id":(\\d+)/', $json, $m)) { $media = json_decode($json); $item->{$field . 'Title'} = $media->title; $m = org_glizycms_mediaArchive_MediaManager::getMediaById($media->id); if ($m->type == 'VIDEO') { $item->{$field . 'Url'} = GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id, true); } else { $item->{$field . 'Url'} = GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id); } } else { $item->{$field . 'Title'} = ''; $item->{$field . 'Url'} = ''; } unset($item->{$field}); }
// if the startup folder is defined all files are included glz_require_once_dir(org_glizy_Paths::get('APPLICATION_STARTUP')); } } $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : NULL; $w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : NULL; $h = isset($_REQUEST['h']) ? intval($_REQUEST['h']) : NULL; $force = isset($_REQUEST['f']) ? $_REQUEST['f'] == 'true' || $_REQUEST['f'] == '1' : false; $crop = isset($_REQUEST['c']) ? $_REQUEST['c'] == 'true' || $_REQUEST['c'] == '1' : false; $useThumbnail = isset($_REQUEST['t']) ? $_REQUEST['t'] == 'true' || $_REQUEST['t'] == '1' : false; $cropOffset = isset($_REQUEST['co']) ? $_REQUEST['co'] : 0; if (is_null($id)) { exit; } glz_import('org.glizycms.mediaArchive.MediaManager'); $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id); if ($useThumbnail && !empty($media->ar->media_thumbFileName)) { $media->ar->media_fileName = $media->ar->media_thumbFileName; $media->ar->media_type = 'IMAGE'; $media = org_glizycms_mediaArchive_MediaManager::getMediaByRecord($media->ar); } if (!is_null($w) && !is_null($h)) { //resize the image if ($media->type != 'IMAGE') { $iconFile = $media->getIconFileName(); header('location: ' . $iconFile); } $mediaInfo = $media->getResizeImage($w, $h, $crop, $cropOffset, $force); } else { // get the full image $mediaInfo = $media->getImageInfo();
private function addMediaById($mediaId) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($mediaId); if ($media == null) { return null; } if ($media->type == 'VIDEO') { return GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id); } else { $this->medias[$media->id] = $media->fileName; return 'media/' . $media->fileName; } }
protected function addLogoCss(&$templateData, $css) { $templateData->headerLogo = @json_decode($templateData->headerLogo); if ($templateData->headerLogo) { $image = org_glizycms_mediaArchive_MediaManager::getMediaById($templateData->headerLogo->id); $fileName = $image->getFileName(); $templateData->customCss .= <<<EOD header .site-logo { background: url("../{$fileName}") no-repeat ; } EOD; } return $css; }
function attachMedia($mediaId) { $this->media =& org_glizycms_mediaArchive_MediaManager::getMediaById($mediaId); if (is_object($this->media)) { if ($this->getAttribute('imageInfo') && !$this->_application->isAdmin()) { $this->imageInfo = $this->media->getImageInfo(); $width = $this->imageInfo['width']; $height = $this->imageInfo['height']; } else { $width = ''; $height = ''; } $this->_content = array(); $this->_content['mediaId'] = $this->media->id; $this->_content['src'] = $this->media->getFileName($this->getAttribute('checkIfExists')); $this->_content['originalSrc'] = $this->_content['src']; $this->_content['alt'] = $this->media->title; $this->_content['title'] = $this->media->title; $this->_content['description'] = $this->media->description; $this->_content['zoom'] = $this->media->zoom; $this->_content['class'] = $this->getAttribute('cssClass'); $this->_content['style'] = ""; $this->_content['onclick'] = ""; $this->_content['width'] = $width; $this->_content['height'] = $height; $this->_content['size'] = $this->media->size; $this->_content['mediaType'] = $this->media->type; /* if ($this->getAttribute('zoom')==true) { $this->_content['onclick'] = 'Glizy.previewImage(\''.$this->media->id.'\');'; $this->_content['style'] = 'cursor: pointer'; } */ } }
private function imageSrc($url) { if (strpos($url, 'getImage.php') !== false) { $url = str_replace(array('getImage.php?', '&'), array('', '&'), $url); $chunks = explode('&', $url); $image = array(); foreach ($chunks as $key => $chunk) { list($k, $v) = explode('=', $chunk); $image[$k] = $v; } // controllo if (!isset($image['id'])) { return ""; } $media = org_glizycms_mediaArchive_MediaManager::getMediaById($image['id']); if (isset($image['w']) && isset($image['h'])) { $mediaInfo = $media->getResizeImage($image['w'], $image['h']); } else { $mediaInfo = $media->getImageInfo(); } return "<img src=\"" . $mediaInfo['fileName']; } }
public function render() { if (is_object($this->_content) && $this->_content->image && $this->_content->hotspots) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($this->_content->image); $speakingUrlManager = $this->_application->retrieveProxy('org.glizycms.speakingUrl.Manager'); if (is_object($media)) { $id = $this->getId(); $imageInfo = $media->getImageInfo(); $width = $imageInfo['width']; $height = $imageInfo['height']; $attributes = array(); $attributes['src'] = $media->getFileName(true); $attributes['width'] = $imageInfo['width']; $attributes['height'] = $imageInfo['height']; $attributes['alt'] = $media->title; $attributes['title'] = $media->title; $image = '<img ' . $this->_renderAttributes($attributes) . ' />'; $hotspots = ''; foreach ($this->_content->hotspots as $h) { $attributes = array(); $attributes['id'] = $id . '-' . $h->id; $attributes['class'] = 'movio-hotspot' . ($h->form == 'circle' ? '-circle' : ''); $attributes['style'] = 'display: block; top: ' . $h->top . 'px; left: ' . $h->left . 'px; height: ' . $h->height . 'px; width: ' . $h->width . 'px;'; if ($h->description) { $attributes['data-tooltip'] = glz_encodeOutput($h->description); } $link = ''; if ($h->type = 'linkEx' && $h->src) { $link = __Link::formatLink($h->src); } else { if ($h->type = 'link' && $h->srcInt) { $link = __Link::formatInternalLink($speakingUrlManager->makeUrl($h->srcInt)); } } if ($link) { $link = str_replace('<a ', '<a style="text-indent: -9999px; height: ' . $h->height . 'px; width: ' . $h->width . 'px; display: block;"', $link); } // <a target="_blank" style="height: 148px; width: 186px; display: block;" href="www.google.com" class="hotspot-circle"></a> $hotspots .= '<div ' . $this->_renderAttributes($attributes) . '>' . $link . '</div>'; } $css = trim('movio-hotspotContainer ' . $this->getAttribute('cssClass')); $output = <<<EOD <div id="{$id}" class="{$css}"> {$image} <div class="movio-imageHotspot-scale"> {$hotspots} </div> </div> <script src="static/jquery/jquery-transform/jquery.transform2d.js"></script> <script> jQuery( function(){ \$('div.movio-hotspotContainer').find('div[data-tooltip!=""]').qtip({ content: { attr: 'data-tooltip' }, position: { my: 'bottom left', at: 'bottom left', target: 'mouse' }, style: { classes: 'qtip-bootstrap' } }); var img = \$('div.movio-hotspotContainer img').first(); var scale = img.width() / parseInt(img.attr('width')); \$('.movio-imageHotspot-scale').css('transform', 'scale('+scale+','+scale+')'); }); </script> EOD; $this->addOutputCode($output); $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery.qtip/jquery.qtip.min.js'), 'head'); $this->addOutputCode(org_glizy_helpers_CSS::linkStaticCSSfile('jquery/jquery.qtip/jquery.qtip.min.css'), 'head'); } } }
function addMedia($key, $media) { if ($media != '') { $result = new StdClass(); $media = json_decode($media); $m = org_glizycms_mediaArchive_MediaManager::getMediaById($media->id); if ($m == null) { return null; } $result->type = $m->type; $result->title = $media->title; $media->type = $m->type; if ($result->type == 'VIDEO') { $result->url = GLZ_HOST . '/' . org_glizy_helpers_Media::getFileUrlById($media->id, true); } else { $result->fileName = $media->fileName; $this->medias[$media->id] = $media->fileName; } if ($key) { $this->json[$key][$media->id] = $result; } } return $result; }
function attachMedia($mediaId) { $this->media =& org_glizycms_mediaArchive_MediaManager::getMediaById($mediaId); if (is_object($this->media)) { $this->_content['mediaId'] = $this->media->id; $this->_content['src'] = $this->media->getFileName(); $this->_content['title'] = $this->media->title; $this->_content['size'] = $this->media->size; $this->_content['mediaType'] = $this->media->type; } }