Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically create image thumbnails (using django)

Tags:

I would like to dynamically create thumbnails based on parameters in the URL. For example, http://mysite.com/images/1234/120x45.jpg would create a 120x45 thumbnail for image id 1234.

The obvious solution to this is to have a django view which does the following:

  1. Look for a previously cached version of the image at this size.
  2. Create a thumbnail if it's not cached (some logic for locking so that only 1 process creates the thumbnail and other processes wait).
  3. Pipe the results through django.

That should "work", but I'm concerned about performance. I don't like the idea of using django to serve static content. What are some other ways to accomplish this problem?


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!