In the OOP CMS I've been working on, Image objects store their raw  
content in the DB, then the scale and view methods check an on-disk  
cache to see if there is a cached version of the image which fits the  
criteria (view = original, scale = scaled by maximum x, maximum y,  
maximum longest dimension) and redirects to the apache-served copy,  
or generates the appropriate image using PIL, then redirects.

Sharpening is applied to images below 75% (more sharpening the  
smaller the image is).  Line-art is beautiful with this scaling; real- 
world images have not been tested yet.

This does appear to be the best solution I've found in terms of  
flexibility and storage.  Apache serving static files is a bonus.   
E.g. gothcandy.com (a personal sample site using the CMS) has the  
following in WebFaction's control panel:

Domains:
  * gothcandy.com (www)

Applications:
  * gothcandy (TurboGears 1.0)
  * gothcandy_cache (Symbolic Link)
        %(home)s/var/cache/turbocmf
  * gothcandy_static (Symbolic Link)
        %(home)s/webapps/gothcandy/gothcandy/static

Websites:
  * gothcandy (None, www)
        /: gothcandy
        /static: gothcandy_static
        /cache: gothcandy_cache

Bada bing.  An example of an image being returned from the cache is  
the following page:

http://gothcandy.com/alice/2006/12/20/2/in-lieu-of-a-real-post/

The embedded image URL:
         /content/doodle-1.png/scale?x=680
becomes: /cache/00/00/06-6582032d68cbbb0cc978d0852541cf49.png

The full version of the image:
         /content/doodle-1.png/view
becomes: /cache/00/00/06-1f9711cd362cf0c356dc835edb4f1204.png

Cleanup is easy, as the MD5 hash identifying the "arguments" are  
prefixed with a recoverable ID.  Feel free to play with the scaling,  
e.g.:

* http://www.gothcandy.com/content/doodle-1.png/scale?xy=100
* http://www.gothcandy.com/content/doodle-1.png/scale?x=100
* http://www.gothcandy.com/content/doodle-1.png/scale?y=480

Matthew Bevan, Systems Administrator
Top Floor Computer Systems Ltd.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to