Back to PhocacartImage class

Method getImage

public static
getImage
(mixed $image, mixed $path = '', mixed $width = '', mixed $height = '')

Method getImage - Source code

public static function getImage($image, $path = '', $width = '', $height = '')
{
    //$imageHTMLHelper::cleanImageURL($image);
    $imgClean = HTMLHelper::cleanImageURL($image);
    if ($imgClean->url != '') {
        $image = $imgClean->url;
    }
    if (File::exists(JPATH_ROOT . '/' . $image)) {
        $style = ' style="';
        if ($width != '') {
            $style .= 'width: ' . $width . ';';
        }
        if ($height != '') {
            $style .= 'height: ' . $height . ';';
        }
        $style .= '" ';
        if ($path != '') {
            $path = $path . '/';
        }
        return '<img src="' . Uri::root(true) . '/' . $path . $image . '"' . $style . 'alt=""/>';
    } else {
        return false;
    }
}