On Tue, Nov 25, 2008 at 9:04 PM, Jeff Anderson <[EMAIL PROTECTED]> wrote: > Aneurin Price wrote: >> Hello, >> >> I'd like to be able to generate images dynamically for a Django-based >> website, and I'm wondering how best to go about it. >> >> The idea is to do certain things to existing images, such as >> superimpose them on a background. The set of base images will be >> more-or-less static; it's just the operation performed on it which >> might change, so I don't really want to create an image model and have >> to instantiate it for each image. Rather I'd like to be able to simply >> put them in a directory, so I can make a request for >> 'imagename-operation.png', and have my application check to see if it >> exists in a cache, and if not, look for 'imagename.png' in the base >> images directory and apply the given operation to it. I'm fine with >> the image operations, but I can't decide where I should be doing this >> work. >> >> I'm tempted to do it all in a view, so 'imagename' and 'operation' are >> parsed from the request name and passed to the appropriate function, >> which returns the image. Doing it in the view however doesn't really >> feel right, and I wondered if perhaps I would be better with some >> custom middleware, or something else entirely. >> > A view is the right place to do this. A view takes a request, parses it, > and returns the response. This process holds true for html, an image,
When stated so simply, the answer is obvious, of course. Thank you for your help, Nye --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

