Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 920651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:45:04+00:00 2026-05-15T18:45:04+00:00

I am working on a Google app engine project where I have saved some

  • 0

I am working on a Google app engine project where I have saved some images in the datastore.
Now I have to resize these images and render them to the template. I have successfully fetched the images but I am not getting,how to render them with other data dictionaries to the template. I am using App engine patch with GAE.

Following is a code snippet that I am using in my view:

def getData(request,key):
forum = Topic.get(key)
picData = forum.creator.portfolio_set
response = ''
if picData:
    picture = picData[0].userpic
    response = HttpResponse(picture, mimetype="image/jpeg")
    #response['Content-Type'] = 'image/jpeg'
    response['Content-Disposition'] = 'inline'
return render_to_response(request,"forum.html",{"forum":forum,"pic":response })

Now, I am able to render the data within forum variable but not getting how to render the image associated with it. What should I modify in my views file and what should I use in my template to display the image rendered by the views file.

Please suggest.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:45:05+00:00Added an answer on May 15, 2026 at 6:45 pm

    Solution 1:

    Add a generic view to get images e.g. /images/image-id should return image for that ID

    def get_image(request, image_id):
    ….

    picture = get from id
    return HttpResponse(picture, mimetype="image/jpeg")
    

    Now use image URLs inside your forum.html template, like you would use any normal image URL.

    Solution 2: You can directly embed image using data:image see http://en.wikipedia.org/wiki/Data_URI_scheme

    so try this

    import base64
    
    def getData(request,key):
        forum = Topic.get(key)
        picData = forum.creator.portfolio_set
        pictureSrc = ''
        if picData:
            picture = picData[0].userpic
            pictureSrc = "data:image;base64,%s"%base64.b64encode(picture)
    
        return render_to_response(request,"forum.html",{"forum":forum,"pic":pictureSrc })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a django- Google app engine project. A user inserts some
I am working on a Django project on Google App Engine. I have a
I'm working with DataNucleus as part of a Google App Engine project and I'm
I'm working on a project, using Python running on Google App Engine. The project
I'm working on a Google App Engine program that will require some basic spell
I am working on a google app engine project using python. I want to
I am working on a java project on Google app engine and when I
I just started working on a project that will run on google app engine
I'm working on an google app engine app that will have to deal with
I'm currently working on a project using Flask and Google App Engine . Calling

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.