← Back to team overview

schooltool-developers team mailing list archive

Photo instance

 

Gentlemen:

I've implemented most of the functionality Justas and I discussed during the sprint for the photo work:

* Use of blobs for storing the images (using zope.file's File objects)

* Data converter that accepts only image mime types (JPEG, PNG, GIF and BMP). If you try to upload a PDF, you should get a validation error. The converter also resizes the image, using 99px for maximum width or 128 for maximum height. This is the ratio of the passport photo. Of course, we can modify these values to store larger images, I just chose those because it's the area of the image in the person index view

* The person index view adapts the general information table width if there's a photo, so the photo doesn't overlap the table

* There's a new @@photo view on person objects that returns the image data setting the appropriate headers, such as content type and length. It also sets a If-Modified-Since header according to the last time the person object was modified. This allows the browser to use its cache instead of requesting the image on every request

* The edit person view allows the user to delete the existing image or upload a new one

You can see it in action:

http://69.164.203.135:6662/persons/douglas (vertical JPEG)
http://69.164.203.135:6662/persons/camila (horizontal PNG)
http://69.164.203.135:6662/persons/teacher001 (GIF)
http://69.164.203.135:6662/persons/teacher002 (BMP)

The branch is at:

lp:~replaceafill/schooltool/flourish_photos

I'd appreciate your feedback on functionality and code issues.

Thanks.

Douglas

"... allí­ es cuando te das cuenta que las cosas malas pueden resultar bastante buenas..." - Lionel Messi

Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.
Vea http://www.gnu.org/philosophy/no-word-attachments.es.html


Follow ups