function perform()
 {
     $galleryResources = new GalleryResources();
     $galleryAlbums = new GalleryAlbums();
     // initialize the view
     $this->_view = new BlogView($this->_blogInfo, VIEW_RESOURCE_TEMPLATE, SMARTY_VIEW_CACHE_CHECK, array("resourceId" => $this->_resourceId, "resourceName" => $this->_resourceName, "albumName" => $this->_albumName, "albumId" => $this->_albumId));
     // if it's cached, do nothing
     if ($this->_view->isCached()) {
         return true;
     }
     // otherwise continue as normal...
     // try to find the album to which this resource belongs
     if ($this->_albumName) {
         $album = $galleryAlbums->getAlbumByName($this->_albumName, $this->_blogInfo->getId(), false, false);
         if (!$album) {
             $this->_view = new ErrorView($this->_blogInfo);
             $this->_view->setValue("message", "error_fetching_resource");
             $this->setCommonData();
             return false;
         }
         $this->_albumId = $album->getId();
     }
     // fetch the album we're trying to browse
     if ($this->_resourceName != "") {
         $resource = $galleryResources->getResourceFile($this->_blogInfo->getId(), $this->_resourceName, $this->_albumId);
     } else {
         $resource = $galleryResources->getResource($this->_resourceId, $this->_blogInfo->getId(), $this->_albumId);
     }
     // check if the album was correctly fetched
     if (!$resource) {
         $this->_view = new ErrorView($this->_blogInfo);
         $this->_view->setValue("message", "error_fetching_resource");
         $this->setCommonData();
         return false;
     }
     // if all went fine, continue loading the next and previous resources so that
     // navigation can be made easier...
     $nextResource = $galleryResources->getNextResource($resource);
     $prevResource = $galleryResources->getPreviousResource($resource);
     // generate events for all the resources we just loaded
     $this->notifyEvent(EVENT_RESOURCE_LOADED, array("resource" => &$resource));
     if ($nextResource) {
         $this->notifyEvent(EVENT_RESOURCE_LOADED, array("resource" => &$nextResource));
     }
     if ($prevResource) {
         $this->notifyEvent(EVENT_RESOURCE_LOADED, array("resource" => &$prevResource));
     }
     $this->_view->setValue("resource", $resource);
     $this->_view->setValue("prevresource", $prevResource);
     $this->_view->setValue("nextresource", $nextResource);
     $this->setCommonData();
     // and return everything normal
     return true;
 }