public function index() { $timespanInHours = $this->input->get('timespanInHours'); if ($timespanInHours == null) { // Last 24 hours by default $timespanInHours = 24; } $api = new ImageWallApi(); $tags = $api->getTags($timespanInHours * 60); $data = array('timespanInHours' => $timespanInHours); if (!isset($tags->error)) { // Get min and max occurrences // TODO: Make the API do it instead // Find min and max $occurrencesMin = -1; $occurrencesMax = 0; foreach ($tags as $tag) { $occurrences = $tag->occurrences; if ($occurrencesMin == -1 || $occurrences < $occurrencesMin) { $occurrencesMin = $occurrences; } if ($occurrences > $occurrencesMax) { $occurrencesMax = $occurrences; } } // Add the 'size' value to every tag object so that view can // properly render it foreach ($tags as $tag) { $tag->size = $this->getSize($occurrencesMin, $occurrencesMax, $tag->occurrences); } $data['tags'] = $tags; } $this->load->view('homepage', $data); }
public function index() { $imageId = $this->input->get('id'); $api = new ImageWallApi(); $image = $api->getImageById($imageId); $data = array('image' => $image); $this->load->view('image', $data); }
public function index() { $tag = $this->input->get('tag'); $api = new ImageWallApi(); $images = $api->getImagesWithTag($tag); $data = array('images' => $images, 'tag' => $tag); $type = $this->input->get('type'); if ($type == 'iframe') { $this->load->view('images_iframe', $data); } else { $this->load->view('images', $data); } }