Python Forum
Retrieve images base64 encoded MongoDB and Flask
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieve images base64 encoded MongoDB and Flask
#1
I'm developing simple web application using flask , scrapy and mongodb. In my case crawl webpages and store some data in mongodb collection and represent using flask. I stored some images in mongodb as binary. Now I want to retrieve that binary data as images via flask. Currently I retrieved some stored data like this 
<a href="{{ page._id.url }}">{{ page._id.title }}</a>
<p class="mb-4">{{ get_excerpt(page._id.content, q) }}</p>
Now I want to display the images which saved as binary in mongo collection. Collection name is 'page' and stored as 
 
"image": {
        "$binary": {
            "base64": "iVBORw0KGgoAAAANSUhEUgAAAw8AABD+CAYAAAAbJKU5AAAAAXNSR0IArs4c6QAAIABJREFUeJzsvXmYJEd5J/yLyKyrr+nu0dwz/xaprA..................ACAs/weX+u+movGYcQAAAABJRU5ErkJggg=="
 Is there any way to do that?
Reply


Messages In This Thread
Retrieve images base64 encoded MongoDB and Flask - by Nuwan16 - Oct-13-2020, 08:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to send unicode string encoded in utf-8 in http request in Python MaverinCode 1 32,572 Nov-08-2020, 06:45 AM
Last Post: JaiM
  Store Screenshot Selenium + MongoDB Nuwan16 9 3,651 Aug-18-2020, 03:57 AM
Last Post: ndc85430
  filtering by category flask+mongodb Leon79 3 9,480 Jul-19-2020, 04:25 AM
Last Post: ndc85430
  error when trying to update mongodb damian0612 6 3,459 Jul-04-2020, 07:25 PM
Last Post: damian0612
  Extract json-ld schema markup data and store in MongoDB Nuwan16 0 2,474 Apr-05-2020, 04:06 PM
Last Post: Nuwan16
  flask app to save images locally when deployed on heroku not working Prince_Bhatia 1 5,281 Feb-20-2019, 11:59 PM
Last Post: snippsat
  Flask rest api How to retrieve json request raysefo 4 6,130 Jan-20-2019, 06:46 PM
Last Post: raysefo
  storing images in mongodb using python richa828 2 9,390 Jun-06-2018, 08:08 AM
Last Post: richa828
  Begginer - How to choose a server to run my Python script with MongoDB? Mapl 1 3,759 Oct-24-2017, 01:02 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020