Return image and not json
See original GitHub issueDescribe your question
Actually, I’m using Javalin as full JSON API. But, now I need to have a route that return an image, to use it in HTML side as src.
I will have base64. How can I return image that can be known when html will use http://my-link.com/image/2
?
Issue Analytics
- State:
- Created 9 months ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
How do you put an image file in a json object? - Stack Overflow
I can think of doing it in two ways: 1. Storing the file in file system in any directory (say dir1 ) and...
Read more >How get image and correct json file in apache NiFi...
I need to send a file in jpeg format and a json string in post-request. Screenshots below By sending this - 333513.
Read more >Describing Responses - Swagger
JSON is the most common format for data exchange, but not the only one possible. ... This operation returns image; /logo: get: summary:...
Read more >Show Images from URLs in a JSON file using JavaScript
I am sharing an example here that explains how to show images using image URLs extracted from a JSON file in JavaScript.
Read more >Display Icons / Images from JSON File in React JS - YouTube
Inside React JS main return statement, we take a div. ... Require image may not work here where images are defined in JSON...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Happy to hear that! (I would again like to encourage you to store the image as binary blob instead of doing base64-decoding on every request ☺️).
Thanks, I fixed it by using
ctx.result(Base64.getDecoder().decode(img.getImage())).contentType(img.getImageType());
after removing thedata:image/png;base64,
part