melinath / django-daguerre

On-the-fly image manipulation for Django.
http://django-daguerre.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
85 stars 15 forks source link

Check for an existing AdjustedImage before issuing a redirect. #28

Closed melinath closed 11 years ago

melinath commented 11 years ago

Currently, we focus on reducing initial page load by always just generating a redirect link for the {% adjust %} tag. This can result in a large number of addition request/response cycles, since for every image, the user is redirected, then the actual image is fetched or generated, then the user is redirected again. Although this is fine for cases in which the image doesn't exist at the time the page is loaded, we should be able to save the extra cycle in most cases by just checking ahead whether or not the adjusted version exists. In the end the database load should be the same; the user may have to wait longer initially, but they'll be able to avoid the latency on every other request. This would combine well with #25.

(The funny thing is, I think this is the way we did things originally, before I decided to get clever.)