/** * returns an array map of urls (thumb/element) for image_row - to be returned * in a standard way by different web service methods */ function ws_std_get_urls($image_row) { $ret = array(); $ret['page_url'] = make_picture_url(array('image_id' => $image_row['id'], 'image_file' => $image_row['file'])); $src_image = new SrcImage($image_row); if ($src_image->is_original()) { // we have a photo global $user; if ($user['enabled_high']) { $ret['element_url'] = $src_image->get_url(); } } else { $ret['element_url'] = get_element_url($image_row); } $derivatives = DerivativeImage::get_all($src_image); $derivatives_arr = array(); foreach ($derivatives as $type => $derivative) { $size = $derivative->get_size(); $size != null or $size = array(null, null); $derivatives_arr[$type] = array('url' => $derivative->get_url(), 'width' => $size[0], 'height' => $size[1]); } $ret['derivatives'] = $derivatives_arr; return $ret; }
/** * @return string */ function get_url() { if ($this->params == null) { return $this->src_image->get_url(); } return embellish_url(trigger_change('get_derivative_url', get_root_url() . $this->rel_url, $this->params, $this->src_image, $this->rel_url)); }