-
Notifications
You must be signed in to change notification settings - Fork 457
Set a Content-Type #1151
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
Comments
Hey @Sampath-Lokuge I responded to your stackoverflow post Couple quick things, Also, you can set the content type on the response object ( In your case, I'd use: var buffer = stream; // make sure you're using buffer
context.res.type(Jimp.MIME_JPEG).raw(buffer); |
Hi @mamaso Still, it is not working for me.This is the final code.please check whether is that ok or not?
|
Ah, my mistake, I thought that you were using an http response binding. I see that you're using a blob output binding. Unfortunately there isn't a way to specify the content type for a blob output binding from node. You could chose to drop the blob output binding and explicitly use the azure storage sdk inside your function to store the blob, which would give you access to the blob. Also, a C# function has the ability to set content-type on a blob as it can use the |
Hi @mamaso On node there is a way to do that.
Don't we have a way to convert this into Azure function? Can't we use it like this? why below code is not working ?
|
It depends on what your goal is: do you want to send an http response with the blob as body and content type set correctly? Yes, it can be done (that's what the node example is doing). If you want to store the blob in azure storage with a content type, that is not possible via node (unless if you use the azure storage sdk). |
Hi @mamaso , Actually, my requirement is to show the converted thumbnail image on the UI. Hence this is stream it automatically downloaded instead of showing as an image. So is there a way to show it as an image when I need to show on the UI. It doesn't matter where stored as a stream on the blob container.I just need to show as an image on the front end. Any workaround? |
It seems that you're using your function to create the thumbnails, once they're created and uploaded in the blob (which your original function should accomplish, without the content-type) I think you can use an |
Hi @mamaso You're right.That is my bad.Thanks a lot for your support.Have a nice day ahead! |
Great, happy to help, have a good one! |
Hi,
I have followed Background image thumbnail processing with Azure Functions and NodeJS article to create Azure functions.It is working fine. The problem which I have is, how to set the
Content-Type
on the thumbnailed image.At this moment it is Stream.function.json
I have tried as shown below.But it is not working.
index.json
The text was updated successfully, but these errors were encountered: