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 9061825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:35:02+00:00 2026-06-16T15:35:02+00:00

Having a hard time to upload and display image in python gae. Here is

  • 0

Having a hard time to upload and display image in python gae.

Here is what I did.
1. in the app.yaml file, I added:

handlers:

- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: /(.*\.(gif|png|jpg))
  static_files: /\1
  upload: (.*\.(gif|png|jpg))

- url: .*
  script: main.app
  1. Then put down:

in

def Character(db.Model):
   avatar = db.BlobProperty()

under my handler:

if avatar:
  character_info.avatar = db.Blob(images.resize(avatar, 240,360))
   character_key = character_info.put()

I can see a binary input in gae admin data viewer, but not sure exactly how it works to call it. Then, I passed the characters object into the PageHandler and called a for loop to get each avatar.

{% for character in characters %}
#{{another html page is render here}}
{% endfor %}

tried these, but None of them works.

<img src="/images?img_id={{character.key()}}"></img>
<img src="/images/header.jpg"></img>
<img src="/avatar?avatar_id={{character.key()}}"></img>

So my questions are:

  1. How do you determine “/images”(this is the folder?) or “img_id” are the right syntax to use?

  2. I don’t see any image uploaded to my localhost, is that correct?

  3. Calling an image directly from a folder like <img src="/images/header.jpg"></img> doesn’t work…(in php it’s works….)

Thanks in advance, any help will be appreciated!

  • 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-06-16T15:35:03+00:00Added an answer on June 16, 2026 at 3:35 pm

    Alright, I figured out what I did wrong was I didn’t add an image handler.

    So

    class ImageHandler(Handler):
        def get(self):
            character = db.get(self.request.get('img_id'))
            if character.avatar:
                self.response.headers['Content-Type'] = 'image/png'
                self.response.out.write(character.avatar)
            else:
                self.response.out.write("No image")
    

    This solves my problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having hard time finding a way to display a loading image in
I am having a hard time with my image upload script, getting the images
I am new here, but I am having hard time figuring out how to
Having a hard time with labels on a ggplot2 plot. Here's a similar plot
im having a hard time saving the image captured from the webcam using the
I am having a hard time using $_FILES I want to check if file
I'm having a hard time figuring out on how to cache the image from
In a ASP.NET application, users are having a hard time trying to upload files.
I am learning recursion and having hard time in tracing recursion. Here is my
Hehe I'm having hard time on choosing the question title. But let me explain

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.