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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:17:52+00:00 2026-06-05T09:17:52+00:00

I have an image in blob store which is uploaded by users(their profile pic).

  • 0

I have an image in blob store which is uploaded by users(their profile pic). I want to make a copy of the same and and re-size the copy so that it can be displayed as a thumbnail. I want to make a copy of the same instead of using the ImageService because this would be used more often compared to the profile image.

What I am doing here is this:

reader = profile_image.open() #get binary data from blob
data = reader.read()

file_name = files.blobstore.create(mime_type=profile_image.content_type)#file to write to

with files.open(file_name, 'a') as f:
   f.write(data)

files.finalize(file_name)


blob_key = files.blobstore.get_blob_key(file_name)

image = images.Image(blob_key = blob_key)
image.resize(width=32, height=32)

entity.small_profile_pic = <MyImageModel>(caption=<caption given by user>,
                                       picture=str(blob_key))

This is giving me error:

BadValueError: Image instance must have a complete key before it can be stored as a reference.

I think this is because the blob is not saved(put()) into the datastore, but how do i do it. Doed files.blobstore.get_blob_key(file_name) not do it ?

I would also like to ask: does the blobstore also cache the dynamically transformed images images served using get_serving_url() …

  • 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-05T09:17:53+00:00Added an answer on June 5, 2026 at 9:17 am

    I would use the get_serving_url method. In the doc is stated that:

    The get_serving_url() method allows you to generate a stable, dedicated URL for serving web-suitable image thumbnails. You simply store a single copy of your original image in Blobstore, and then request a high-performance per-image URL. This special URL can serve that image resized and/or cropped automatically, and serving from this URL does not incur any CPU or dynamic serving load on your application (though bandwidth is still charged as usual). Images are served with low latency from a highly optimized, cookieless infrastructure.

    Also the code you posted doesn’t seem to follow the exampled posted in the docs. I would use something like this

    img = images.Image(blob_key=original_image_key)
    img.resize(width=32, height=32)
    thumbnail = img.execute_transforms(output_encoding=images.JPEG)
    file_name = files.blobstore.create(mime_type='image/jpeg')#file to write to
    with files.open(file_name, 'a') as f: 
        f.write(thumbnail)
    files.finalize(file_name)
    blob_key = files.blobstore.get_blob_key(file_name)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have image and txt file of same size say 200 KB. Now i
I have an image file which is stored onto database as a blob (shown
I want to store an image in a MySQL database. I have created a
we store image files into database as BLOB type, but i have to save
Assume I have an image uploaded to a store on Shopify called 'logo.png'. In
So I have Image like this (source: de-viz.ru ) I want to get something
So I have Image like this (source: de-viz.ru ) I want to get something
I store user-uploaded images in the Google App Engine datastore as db.Blob , as
I have a servlet which serves an image file which was stored in a
I have an AppEngine application that uses the blobstore to store user-provided image data.

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.