-
-
Notifications
You must be signed in to change notification settings - Fork 21
Display output image in n8n #12
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
base: main
Are you sure you want to change the base?
Conversation
src/OperationsCollector.ts
Outdated
.map(([_, data]) => (data as ResponseObject).content) | ||
.map((content) => Object.keys(content!)) | ||
.flat() | ||
.filter((contentType) => contentType.match(/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.
Do we need to handle only images or just regular binary data would be fine?
https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/#n8n-binary-file
I'm not expert in how n8n handle files, but may be we could add some general logic for all binary content types? 🤔
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.
The link for send API, sorry, but the idea is the same - can all binary files be handled this way?
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.
All the binary files are handled the same. The key is to put the good fileType
inside the postReceive
function.
Here is the list of possible keys: https://github.com/n8n-io/n8n/blob/91069f057e8e1bc32b4e2040a53e5c4546b2991f/packages/workflow/src/Interfaces.ts#L44.
I didn't make tests for HTML and text but they should work exactly the same as for the images, videos, audios and pdf.
60683f2
to
a9f9414
Compare
a9f9414
to
1907e64
Compare
Hi @devlikepro, |
Description
Sometimes, APIs return raw images or REST errors in the same endpoint. Right now, if this is the case, the image is shown raw in a
json
key in n8n and needs more nodes to be shown. This PR would allow us to show the image directly in the result part.Effects in n8n UI
Display the image directly in the node's window as in the HTTP Request Node .
Side effects
If some use the raw image directly, it might cause them issues. I haven't investigated how it's passed to the next node.