WebFaction
Community site: login faq

Hello,

Would like to ask if anybody can help me with image dimensions.

I have DJango 1.4.1 and Admin setup all working and I have imagefields also in models so I can upload images in Admin. How can I insert when I upload image lets say 238x121 the dimensions into DB records. That I can use those numbers it can be in the db width & height etc....like automatical detection of the image size by uploading it, That I can use those numbers in html templates for each image to set the w & h attributes of it.

Thanks for help...

asked 28 Aug '12, 17:07

rentgeeen
4721319
accept rate: 0%


The Django ImageField handles dimensions automatically - just define the fields to store them, and pass those field names to width_field and height_field in your model.

permanent link

answered 28 Aug '12, 20:10

seanf
12.2k41936
accept rate: 37%

woow, thats even better thanks a lot :)

(28 Aug '12, 23:16) rentgeeen
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×12
×12
×7
×2

question asked: 28 Aug '12, 17:07

question was seen: 1,942 times

last updated: 28 Aug '12, 23:16

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM