public function large_url()
 {
     if (STORAGE_STRATEGY == 's3') {
         return s3_url('l', $this->image_key);
     } else {
         return WWW_SERVER . "/image.php?s=l&i=" . $this->image_key;
     }
 }
Example #2
0
function get_image_url($params, &$smarty)
{
    if (STORAGE_STRATEGY == 's3') {
        return s3_url($params['size'], $params['id']);
    } else {
        return WWW_SERVER . '/image.php?i=' . $params['id'] . '&s=' . $params['size'];
    }
}
Example #3
0
 function get_data()
 {
     $return = null;
     $this->leaflet_search->number = $this->count;
     $search = factory::create('search');
     //cosntituency
     if ($this->method == 'constituency') {
         $constituency = null;
         // for now we are only handling the guardian
         if (isset($this->all_arguments['aristotle_id'])) {
             $result = $search->search_cached("constituency", array(array("guardian_aristotle_id", "=", $this->all_arguments['aristotle_id'])));
             if (count($result) > 0) {
                 $constituency = $result[0];
             }
         } else {
             $result = $search->search_cached("constituency", array(array("url_id", "=", $this->all_arguments['constituency'])));
             if (count($result) > 0) {
                 $constituency = $result[0];
             }
         }
         //if constituency, proceed
         if (isset($constituency)) {
             $this->leaflet_search->constituency_id = $constituency->constituency_id;
             $this->success = true;
             $return = $this->leaflet_search->search();
         }
     }
     //party
     if ($this->method == 'party') {
         // for now we are only handling the guardian
         if (isset($this->all_arguments['party_id'])) {
             $this->leaflet_search->publisher_party_id = $this->all_arguments['party_id'];
             $this->success = true;
             $return = $this->leaflet_search->search();
         }
     }
     //latest
     if ($this->method == 'latest') {
         $this->success = true;
         $return = $this->leaflet_search->search();
     }
     //image
     if ($this->method == 'image') {
         if (isset($this->all_arguments['leaflet_id']) && isset($this->all_arguments['size'])) {
             $search = factory::create('search');
             $result = $search->search_cached("leaflet_image", array(array("leaflet_id", "=", $this->all_arguments['leaflet_id'])));
             if (count($result) > 0) {
                 return s3_url($this->all_arguments['size'], $result[0]->image_key);
                 // return WWW_SERVER . '/image.php?i=' . $result[0]->image_key . '&s=' . $this->all_arguments['size'];
             }
         }
     }
     return $return;
 }