Skip to content

Commit 29056e7

Browse files
committed
update local thumbnail to relative
1 parent c5a955a commit 29056e7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Support/Thumbnails/LocalThumbnail.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LocalThumbnail extends Thumbnail
2323

2424
protected bool $fit;
2525

26-
protected bool $appendTimestamp = true;
26+
protected bool $appendHash = true;
2727

2828
public function __construct()
2929
{
@@ -88,8 +88,11 @@ private function generateThumbnail(string $sourceDisk, string $sourceRelPath, st
8888
}
8989
}
9090

91-
return $thumbnailDisk->url($thumbnailPath)
92-
.($this->appendTimestamp ? '?'.$thumbnailDisk->lastModified($thumbnailPath) : '');
91+
return sprintf(
92+
'/%s?%s',
93+
uri($thumbnailDisk->url($thumbnailPath))->path(),
94+
hash_file('xxh3', $thumbnailDisk->path($thumbnailPath))
95+
);
9396
}
9497

9598
public function download(): ?string
@@ -109,6 +112,9 @@ public function download(): ?string
109112
}
110113
}
111114

112-
return $this->storage->disk('public')->url($this->mediaModel->file_name);
115+
return sprintf(
116+
'/%s',
117+
uri($this->storage->disk('public')->url($this->mediaModel->file_name))->path()
118+
);
113119
}
114120
}

0 commit comments

Comments
 (0)