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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:40:45+00:00 2026-06-17T07:40:45+00:00

If a user uploads an image, and I resize it using PIL, I get

  • 0

If a user uploads an image, and I resize it using PIL, I get a PIL Image object.

How do I display a PIL Image file in a template, before it has been saved to the database? Can it even be passed in as an image and rendered?

  • 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-17T07:40:46+00:00Added an answer on June 17, 2026 at 7:40 am

    For a limited set of browsers, you can base64 encode the image and use inline images. See Embedding Base64 Images.

    A solution that works for all browsers is an image tag referencing a view that returns the image.

    [update]

    All I want is for the user to submit the original image, and then be prompted by another form to input a caption for the image (with the resized image to the left of the caption field). Then when the user hits “submit” the image and the caption get saved in a model instance.

    Well… When you use <img src="foo">, foo is always retrieved by a GET perhaps that is why it is not working – request.FILES will not be available in a GET request. If you open firebug or the chrome debug toolbar, in the network tab, you will see the POST request with the uploaded image and after that a GET request to fetch the image.

    You have to save the image somewhere between both steps.

    how else could i save it? I would love for it to be temporary. Do you think there’s a really easy way to do this, or should I go look into those options?

    Popular choices are redis and memcached. You can think of them as giant shared python dict with an expire date. If the images are small, like an avatar, you can also save the image data in a session variable.

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

Sidebar

Related Questions

I am trying to resize an image before it gets saved. I am using
I have a very simple page with which a user uploads a file. Using
I have been working on an image gallary. When the user uploads an Image
I have been trying to upload an image using CodeIgniter's File Upload class. The
I'm trying to upload/resize an image using Ajax and then display it in the
Whenever a user uploads a new image, and the image name remains the same
My app uploads an image and user/email/pass upon registration. iOS to php to mySQL.
I made an upload system where the user uploads a file and that file
I want to resize the resolution of an image before uploading it to local
I've been trying to figure out how to resize an uploaded image in PHP

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.