File tree Expand file tree Collapse file tree 4 files changed +20
-11
lines changed
resources/views/components/embeds Expand file tree Collapse file tree 4 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 66
77<p >
88 <a href =" {{ $media -> downloadUrl () } }" download =" {{ $name } }" target =" _blank" >
9- {{ $legend ?? $name } }
9+ {{ $legend ?: $name } }
1010 </a >
1111</p >
Original file line number Diff line number Diff line change @@ -20,19 +20,35 @@ protected function clearMediaDirectory(): void
2020
2121 protected function makeImageEmbed (?Media $ media = null , ?string $ legend = null ): string
2222 {
23- $ media ??= Media::factory ()->image (' embed ' )->withFile ()->make ();
23+ $ media ??= Media::factory ()->image ()->withFile ()->make ();
2424
2525 return sprintf (
2626 '<x-ozu-content-image file="%s" legend="%s"></x-ozu-content-image> ' ,
2727 e (json_encode ([
2828 'file_name ' => $ media ->file_name ,
2929 'disk ' => $ media ->disk ,
30+ 'mime_type ' => $ media ->mime_type ,
3031 'filters ' => $ media ->filters ,
3132 ])),
3233 $ legend ?: ''
3334 );
3435 }
3536
37+ protected function makeFileEmbed (?Media $ media = null , ?string $ legend = null ): string
38+ {
39+ $ media ??= Media::factory ()->image ()->withFile ()->make ();
40+
41+ return sprintf (
42+ '<x-ozu-content-file file="%s" legend="%s"></x-ozu-content-file> ' ,
43+ e (json_encode ([
44+ 'file_name ' => $ media ->file_name ,
45+ 'disk ' => $ media ->disk ,
46+ 'mime_type ' => $ media ->mime_type ,
47+ ])),
48+ $ legend ?: ''
49+ );
50+ }
51+
3652 public function makeVideoEmbed (?string $ videoUrl = null , ?string $ legend = null ): string
3753 {
3854 $ videoUrl = $ videoUrl ?: collect (
Original file line number Diff line number Diff line change @@ -26,10 +26,7 @@ public function __construct(
2626 public ?string $ legend = null
2727 ) {
2828 if ($ this ->file = json_decode (htmlspecialchars_decode ($ file ), true )) {
29- $ this ->media = Media::make ([
30- 'file_name ' => $ this ->file ['file_name ' ],
31- 'disk ' => $ this ->file ['disk ' ] ?? null ,
32- ]);
29+ $ this ->media = Media::make ($ this ->file );
3330 $ this ->disk = Storage::disk ($ this ->media ->disk );
3431 $ this ->exists = $ this ->disk ->exists ($ this ->media ->file_name );
3532 $ this ->name ??= basename ($ this ->media ->file_name );
Original file line number Diff line number Diff line change @@ -28,11 +28,7 @@ public function __construct(
2828 public ?int $ thumbnailHeight = null ,
2929 ) {
3030 if ($ this ->file = json_decode (htmlspecialchars_decode ($ file ), true )) {
31- $ this ->media = Media::make ([
32- 'file_name ' => $ this ->file ['file_name ' ],
33- 'disk ' => $ this ->file ['disk ' ] ?? null ,
34- 'filters ' => $ this ->file ['filters ' ] ?? null ,
35- ]);
31+ $ this ->media = Media::make ($ this ->file );
3632 $ this ->disk = Storage::disk ($ this ->media ->disk );
3733 $ this ->exists = $ this ->disk ->exists ($ this ->media ->file_name );
3834 $ this ->name = $ this ->file ['name ' ] ?? basename ($ this ->media ->file_name );
You can’t perform that action at this time.
0 commit comments