Module: nagvis Branch: master Commit: 2e0d104a1e318ccb109ff3e282611f315a89f59e URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=2e0d104a1e318ccb109ff3e282611f315a89f59e
Author: Lars Michelsen <[email protected]> Date: Mon Jun 7 19:29:04 2010 +0200 Skipping the automap thumbnail generation silently if the automap image does not exists --- share/server/core/classes/GlobalIndexPage.php | 40 +++++++++++++----------- 1 files changed, 22 insertions(+), 18 deletions(-) diff --git a/share/server/core/classes/GlobalIndexPage.php b/share/server/core/classes/GlobalIndexPage.php index 836371d..645bba5 100644 --- a/share/server/core/classes/GlobalIndexPage.php +++ b/share/server/core/classes/GlobalIndexPage.php @@ -142,25 +142,29 @@ class GlobalIndexPage { $imgPath = $this->CORE->getMainCfg()->getValue('paths', 'sharedvar') . $mapName . '.png'; $imgPathHtml = $this->CORE->getMainCfg()->getValue('paths', 'htmlsharedvar') . $mapName . '.png'; - // If there is no automap image on first load of the index page, - // render the image - if(!$this->checkImageExists($imgPath, FALSE)) - $MAP->renderMap(); - - if($this->CORE->checkGd(0)) { - $sThumbFile = $mapName.'-thumb.'.$this->getFileType($imgPath); - $sThumbPath = $this->CORE->getMainCfg()->getValue('paths','sharedvar').$sThumbFile; - $sThumbPathHtml = $this->CORE->getMainCfg()->getValue('paths','htmlsharedvar').$sThumbFile; - - // Only create a new thumb when there is no cached one - $FCACHE = new GlobalFileCache($this->CORE, $imgPath, $sThumbPath); - if($FCACHE->isCached() === -1) { - $image = $this->createThumbnail($imgPath, $sThumbPath); + // Only handle the thumbnail immage when told to do so + if($this->CORE->getMainCfg()->getValue('index','showmapthumbs') == 1) { + // If there is no automap image on first load of the index page, + // render the image + if(!$this->checkImageExists($imgPath, FALSE)) + $MAP->renderMap(); + + // If the message still does not exist print an error and skip the thumbnail generation + if($this->checkImageExists($imgPath, FALSE) && $this->CORE->checkGd(0)) { + $sThumbFile = $mapName.'-thumb.'.$this->getFileType($imgPath); + $sThumbPath = $this->CORE->getMainCfg()->getValue('paths','sharedvar').$sThumbFile; + $sThumbPathHtml = $this->CORE->getMainCfg()->getValue('paths','htmlsharedvar').$sThumbFile; + + // Only create a new thumb when there is no cached one + $FCACHE = new GlobalFileCache($this->CORE, $imgPath, $sThumbPath); + if($FCACHE->isCached() === -1) { + $image = $this->createThumbnail($imgPath, $sThumbPath); + } + + $map['overview_image'] = $sThumbPathHtml; + } else { + $map['overview_image'] = $imgPathHtml; } - - $map['overview_image'] = $sThumbPathHtml; - } else { - $map['overview_image'] = $imgPathHtml; } $aMaps[] = array_merge($MAP->MAPOBJ->parseJson(), $map); ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
