Skip to content

Commit

Permalink
Merge pull request #462 from pinkary-project/fix/remove-image-alt-text
Browse files Browse the repository at this point in the history
Replace image alt text with static 'image' value
  • Loading branch information
nunomaduro authored Jul 31, 2024
2 parents 5cc43e4 + bbff806 commit 48631df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public function parse(string $content): string
return (string) preg_replace_callback(
'/!\[(.*?)\]\((.*?)\)/',
static function (array $match) use ($content): string {
$altText = preg_replace('/\.(jpg|jpeg|png|gif)$/i', '', $match[1]);

$disk = Storage::disk('public');

if (! $disk->exists($match[2])) {
Expand All @@ -32,7 +30,7 @@ static function (array $match) use ($content): string {

$url = $disk->url($match[2]);

return "<img class='object-cover mx-auto max-h-[52rem] w-full max-w-[26rem] rounded-lg' src=\"{$url}\" alt=\"{$altText}\">";
return "<img class='object-cover mx-auto max-h-[52rem] w-full max-w-[26rem] rounded-lg' src=\"{$url}\" alt=\"image\">";
},
$content
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<img class='object-cover mx-auto max-h-[52rem] w-full max-w-[26rem] rounded-lg' src="/storage/images/pathtoimage.png" alt="">
<img class='object-cover mx-auto max-h-[52rem] w-full max-w-[26rem] rounded-lg' src="/storage/images/pathtoimage.png" alt="image">

0 comments on commit 48631df

Please sign in to comment.