-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Show error icon / message when thumbnail can't be generated in-app #16843
Conversation
… be generated (e.g. image file too big)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jay-p-b-7span for your pull request! ❤️
Would you be able to provide a quick screenshot to get an idea of how it's going to look?
So I get the
error but it still creates the record in the database just doesn't actually upload the file, is this the behaviour you'd expect to see? |
@freekrai It should get uploaded in any case, but not displayed as the generation of a thumbnail might take up too many resources for larger images. The idea of this pull request is that the user is informed accordingly in such a case, as otherwise it is unclear why no image is displayed. As for this pull request, I'm currently wondering the following:
|
@paescuj yeah I do see the file in uploads so that works as expected and yes, it can be confusing as when you first upload you don't see why there is no thumbnail showing unless you click on the image itself and go into the db record. |
I completely agree with you! |
That said, this does do what's expected so it can be approved and further tweaks made in a future PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
async function onErrorHandle() { | ||
if (!props.src) return; | ||
try { | ||
await api.get(props.src); | ||
} catch (err: any) { | ||
imgError.value = true; | ||
imageError.value = err; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error handling is fetching the image fresh to extract the error, even though the v-image
that throws the error already emits the error. Lets reuse the error emitted by v-image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely agree with you @rijkvanzanten to reuse code. But error emitted by v-image
has responseType ArrayBuffer
which v-error
component would not be able to handle it. Therefore result might look like attached in screenshot.
Reason of making new request
In order to address this responseType ArrayBuffer
, I had made new request.
Solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know for any updates.
It might act like expected, but the code isn't quite there yet 🙂 |
I agree! Besides, I'd like to have at least this point discussed / solved before having it merged (#16843 (comment)):
|
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Hi @freekrai, @jay-p-b-7span! Thank you for contributing to Directus! Before we consider your Pull Request, we ask that you sign our Contributor License Agreement (CLA). This is only required for your first Pull Request. Please review the CLA, and sign it by adding your GitHub username to the contributors.yml file. Thanks! |
I'll close this for now while we're researching a solution for #16843 (comment) |
… be generated (e.g. image file too big)
Description
Fixes #16440, fixes ENG-139
Type of Change
Requirements Checklist
If adding a new feature: