Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing previewUsing to work on attachExisting #163

Open
marlocorridor opened this issue Sep 30, 2022 · 6 comments
Open

Implementing previewUsing to work on attachExisting #163

marlocorridor opened this issue Sep 30, 2022 · 6 comments

Comments

@marlocorridor
Copy link
Contributor

marlocorridor commented Sep 30, 2022

We are using previewUsing to use a conversion file for preview.
image

But on "use existing" button, preview does not work.
image

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.

@marlocorridor
Copy link
Contributor Author

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
      }
    ...

@marlocorridor
Copy link
Contributor Author

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"
	}
}

@marlocorridor
Copy link
Contributor Author

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 :)
        ]);
    }
}

@marlocorridor
Copy link
Contributor Author

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

@marlocorridor
Copy link
Contributor Author

image

@marlocorridor
Copy link
Contributor Author

Preparing the pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant