Open marlocorridor opened 2 years ago
MediaUploadingListItem.vue
methods: {
loadPreview() {
if (this.media.isImage) { // could we change this
this.preview = this.media.previewUrl
} else {
return
}
...
...
if (this.media.previewUrl) { // to this?
this.preview = this.media.previewUrl
} else {
return
}
...
As of inspecting, previewUrl
for attacheExisting
is not using ->previewUsing('preview')
{
"0": {
"id": ...,
"size": 13133,
"mimeType": "application/pdf",
"fileName": "sample-2.pdf",
"collectionName": "",
"extension": "pdf",
"previewUrl": "http://127.0.0.1:9000/.../media/16fc12ce-e916-4e0f-bf65-21fd71b2f3bc/sample-2.pdf"
}
}
class AttachableMediaPresenter implements Arrayable
{
private $media;
public function __construct(Media $media)
{
$this->media = $media;
}
public function toArray(): array
{
return array_merge([
'id' => $this->media->id,
'size' => $this->media->size,
'mimeType' => $this->media->mime_type,
'fileName' => $this->media->file_name,
'collectionName' => $this->media->collection_name,
'extension' => $this->media->extension,
'previewUrl' => $this->media->getFullUrl('preview'), // how could we pass the conversion value :)
]);
}
}
class AttachableMediaPresenter implements Arrayable { ... public function toArray(): array { return array_merge([ ... 'previewUrl' => $this->media->getFullUrl('preview'), // how could we pass the conversion value :) ]); } }
This seems to work, we just need to find where to get the conversion
value
Preparing the pull request
We are using
previewUsing
to use aconversion
file for preview.But on "use existing" button, preview does not work.
We can't seem to find on documents
and we are still looking at the source code. We reviewed the closed issues but still couldn't find a reference.