Example #1
0
/**
 * 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;
}
Example #2
0
    } else {
        $i = 'current';
    }
    $row['src_image'] = new SrcImage($row);
    $row['derivatives'] = DerivativeImage::get_all($row['src_image']);
    if ($i == 'current') {
        $row['element_path'] = get_element_path($row);
        if ($row['src_image']->is_original()) {
            // we have a photo
            if ($user['enabled_high'] == 'true') {
                $row['element_url'] = $row['src_image']->get_url();
                $row['download_url'] = get_action_url($row['id'], 'e', true);
            }
        } else {
            // not a pic - need download link
            $row['download_url'] = $row['element_url'] = get_element_url($row);
        }
    }
    $row['url'] = duplicate_picture_url(array('image_id' => $row['id'], 'image_file' => $row['file']), array('start'));
    $picture[$i] = $row;
    $picture[$i]['TITLE'] = render_element_name($row);
    $picture[$i]['TITLE_ESC'] = str_replace('"', '"', $picture[$i]['TITLE']);
    if ('previous' == $i and $page['previous_item'] == $page['first_item']) {
        $picture['first'] = $picture[$i];
    }
    if ('next' == $i and $page['next_item'] == $page['last_item']) {
        $picture['last'] = $picture[$i];
    }
}
$slideshow_params = array();
$slideshow_url_params = array();