Beispiel #1
0
function tep_catalog_calculate_image($src, &$width, &$height, $relative_path = 0)
{
    extract(tep_load('defs'));
    $images_path = tep_front_physical_path(DIR_WS_CATALOG_IMAGES);
    if ($relative_path == 1) {
        $rel_path = $cDefs->cserver . DIR_WS_CATALOG_IMAGES;
    } elseif ($relative_path == 2) {
        $rel_path = '';
    } else {
        $length = strlen(DIR_FS_CATALOG);
        $rel_path = substr($images_path, $length);
    }
    $resize = true;
    // Get the image's information
    if ($image_size = @getimagesize($images_path . $src)) {
        if (!is_array($image_size) || count($image_size) < 2 || !$image_size[0] || !$image_size[1]) {
            $image = '<img src="' . DIR_WS_CATALOG_TEMPLATE . 'design/' . IMAGE_NOT_AVAILABLE . '"';
            return tep_image_params($image, $alt, $width, $height, $params);
        }
        if (tep_image_dimensions($width, $height, $image_size[0], $image_size[1])) {
            $image = $cDefs->crelpath . 'fly_thumb.php?no_cache=1&img=' . $rel_path . $src . '&amp;w=' . tep_output_string($width) . '&amp;h=' . tep_output_string($height);
            return $image;
        } else {
            $image = $cDefs->cserver . DIR_WS_CATALOG_IMAGES . $src;
            return $image;
        }
    }
    return '';
}
Beispiel #2
0
function tep_calculate_image($src, &$width, &$height)
{
    $resize = true;
    // Get the image's information
    if ($image_size = @getimagesize($src)) {
        if (!is_array($image_size) || count($image_size) < 2 || !$image_size[0] || !$image_size[1]) {
            $image = '<img src="' . DIR_WS_TEMPLATE . 'design/' . IMAGE_NOT_AVAILABLE . '"';
            return tep_image_params($image, $alt, $width, $height, $params);
        }
        if (tep_image_dimensions($width, $height, $image_size[0], $image_size[1])) {
            $image = 'fly_thumb.php?img=' . $src . '&amp;w=' . tep_output_string($width) . '&amp;h=' . tep_output_string($height);
            return $image;
        }
    }
    return '';
}