protected function set_body_data($page_type = 'wide') { parent::set_body_data($page_type); $photo = PhotoCollector::getRow(self::$BANNER_IMAGE); $photo_obj = (object) array( 'file' => "/photo/{$photo->category}/{$photo->name}-size-full.jpg", 'description' => $photo->description, ); $this->set_body('photo', $photo_obj); $recent_log_container; $recent_logs = LogCollector::getRecentList(4); foreach ($recent_logs as $log) { $recent_log_container[] = (object) array( 'photo' => (object) array( 'file' => "/photo/{$log->photo_category}/{$log->photo}-size-thumb.jpg", 'description' => $log->photo_description, ), 'title' => $log->title, 'link' => "/journal/{$log->alias}/", 'date' => date('F j, Y', strtotime($log->publish_date)), ); } $this->set_body('logs', $recent_log_container); $this->set_body('comments', $this->get_comments()); $this->set_body('view', 'Home'); }
protected function get_initial_introduction() { $introduction = array(); $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; $introduction['description'] = self::$PRIMARY_INTRODUCTION_DESCRIPTION; $image = PhotoCollector::getRow(self::$PRIMARY_INTRODUCTION_IMAGE); $introduction['image'] = $this->get_image_element($image->category, $image->name, $image->description, 'medium'); return $introduction; }
protected function get_introduction_image($id) { Loader::load('collector', 'image/PhotoCollector'); $photo_result = PhotoCollector::getRow($id); if($photo_result == null) return; $name = $photo_result->name; $category = $photo_result->category; $size = 'medium'; $height = 375; $width = 500; $description = $photo_result->description; return sprintf(self::$INTRODUCTION_IMAGE_PATTERN, $category, $name, $size, $height, $width, $description); }
private function get_thumb($string, $is_absolute, $size) { list($category, $file_name) = explode('/', $string); list($photo, $extension) = explode('.', $file_name); $file_path = $this->get_file_path($category, $photo, $size, $extension); $file_size = getimagesize($file_path); Loader::load('collector', 'image/PhotoCollector'); $photo_result = PhotoCollector::fetchRow($category, $photo); if ($photo_result == false) { return ''; } $height = $file_size[1]; $width = $file_size[0]; $description = $photo_result->description; $domain = '/'; if ($is_absolute) { $domain = Loader::getRootURL(URLDecode::getSite()); } return sprintf(self::$IMAGE_NODE, $domain, $category, $photo, $size, $extension, $height, $width, $description); }