Efficiently\Larasset\Asset::imageTag PHP Method

imageTag() public method

Returns an HTML image element for the source and attributes specified as arguments from the assets pipeline.
public imageTag ( string $source, string $alt = null, array $attributes = [] ) : string
$source string Relative URL
$alt string
$attributes array HTML attributes
return string
    public function imageTag($source, $alt = null, $attributes = [])
    {
        $assetsOptions = ['host' => array_pull($attributes, 'host', $this->assetsHost)];
        // E.g. image_tag('logo.png', "My Logo"); => <img src="http://localhost/assets/logo-f2331bb588d007ba354e5fa406f9f4aa.png" alt="My Logo">
        $alt = $alt ?: humanize(basename($source, "." . File::extension($source)));
        return app('html')->image($this->assetPath($source, $assetsOptions), $alt, $attributes);
    }