Skip to content

Commit d7863b2

Browse files
Update HtmlBuilder.php
1 parent a0f260c commit d7863b2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Supports/HtmlBuilder.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Contracts\Routing\UrlGenerator;
77
use Illuminate\Contracts\View\Factory;
88
use Illuminate\Support\HtmlString;
9+
use Illuminate\Support\Str;
910
use Illuminate\Support\Traits\Macroable;
1011
use Kris\LaravelFormBuilder\Traits\Componentable;
1112

@@ -100,11 +101,14 @@ public function image($url, $alt = null, $attributes = [], $secure = null): Html
100101
{
101102
$attributes['alt'] = $alt;
102103

104+
$src = $this->url->asset($url, $secure);
105+
106+
if (Str::startsWith($url, ['data:image/png;base64,', 'data:image/jpeg;base64,'])) {
107+
$src = $url;
108+
}
109+
103110
return $this->toHtmlString(
104-
'<img src="' . $this->url->asset(
105-
$url,
106-
$secure
107-
) . '"' . $this->attributes($attributes) . '>'
111+
'<img src="' . $src . '"' . $this->attributes($attributes) . '>'
108112
);
109113
}
110114

0 commit comments

Comments
 (0)