<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>lighty's life: Serving Images From A Database</title>
    <link>http://blog.lighttpd.net/articles/2006/03/10/serving-images-from-a-database</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Serving Images From A Database</title>
      <description>&lt;p&gt;&lt;a href="http://kris.koehntopp.de/"&gt;Kris&lt;/a&gt; tells  you why this usually a bad idea in his article &lt;a href="http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database.html"&gt;Serving Images From A Database&lt;/a&gt;&lt;/p&gt;
</description>
      <pubDate>Fri, 10 Mar 2006 21:58:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f4eb1f93-987f-4af2-8afb-e582bf900d07</guid>
      <author>jan</author>
      <link>http://blog.lighttpd.net/articles/2006/03/10/serving-images-from-a-database</link>
      <trackback:ping>http://blog.lighttpd.net/articles/trackback/137</trackback:ping>
    </item>
    <item>
      <title>"Serving Images From A Database" by Alexander</title>
      <description>Serving images from the database is fine -- usually much preferable to having the app manage files in the file system -- as long as you cache the stuff.

In our case we rely on Lighttpd's adaptive pass-through support to do this: If the path exists locally, it will be served by Lighttpd; otherwise the request will be passed to the FastCGI process.

A URL such as /images/cache/5_48x48.png first goes to the FastCGI process, by way of internal routing. It parses at the file name into an image ID (5), a desired size (48 by 48) and a format (PNG). It retrieves the database content, scales and reformats the image, stores it as /var/www/images/cache/5_48x48.png or whatever. The next time there is a request for this URL, it will be served directly from the file system.

If the file goes away, either intentionally (as when the app wants to invalidate the cache, or when you boot the web app on a different system where the cache is empty) or accidentally (as when you accidentally deleted the cache), then the next request goes back to the app again.</description>
      <pubDate>Fri, 17 Mar 2006 22:16:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:bda0579e-92c9-499e-bfb2-249e8a8eb2fb</guid>
      <link>http://blog.lighttpd.net/articles/2006/03/10/serving-images-from-a-database#comment-144</link>
    </item>
    <item>
      <title>"Serving Images From A Database" by alex</title>
      <description>Yes, that looks like a right solution for me. I overlooked that part of Wiki. Thanks a lot</description>
      <pubDate>Tue, 14 Mar 2006 17:27:15 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ba775103-32ff-4a51-90ef-982db58db64a</guid>
      <link>http://blog.lighttpd.net/articles/2006/03/10/serving-images-from-a-database#comment-142</link>
    </item>
    <item>
      <title>"Serving Images From A Database" by Jan Kneschke</title>
      <description>You mean something like X-LIGHTTPD-send-file ?

It is documented in 

&lt;a href="http://trac.lighttpd.net/trac/wiki/HowToFightDeepLinking" rel="nofollow"&gt;http://trac.lighttpd.net/trac/wiki/HowToFightDeepLinking&lt;/a&gt;

and in the fastcgi docs.</description>
      <pubDate>Tue, 14 Mar 2006 10:36:07 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:cc88efdd-8d57-4a04-9be0-65b361eca267</guid>
      <link>http://blog.lighttpd.net/articles/2006/03/10/serving-images-from-a-database#comment-141</link>
    </item>
    <item>
      <title>"Serving Images From A Database" by alex</title>
      <description>It would be great if Lighty'd have special treatment for relative URL redirects. Lets say dynamic request handler returns redirect to relative thus "local" URL
to static content. Instead of sendind that redirect back to browser Lighty might serve that redirect the same way if browser sent a new request for that URL in response to a redirect.

Saying "redirect" I mean 3xx HTTP response code family.</description>
      <pubDate>Mon, 13 Mar 2006 18:18:15 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:128ddedf-edc6-4c8e-b887-ae69b748d86f</guid>
      <link>http://blog.lighttpd.net/articles/2006/03/10/serving-images-from-a-database#comment-140</link>
    </item>
  </channel>
</rss>
