in reply to Strategies for temporary image files in CGI

I guess if you are asking this question you have no choice, still I wonder whether it's sane to generate online images by updating an Excel worksheet and then extracting images from it. I'm saying this because on a job I had somebody had this devious idea of composing letters by automating (via OLE) MS-Word document compositions. This idea proved awful, because: MS-Office programs were designed to be invocated and used by humans, so are not really fit as server-side components. If you have a choice, I believe you should investigate graphic creation modules (like GD) that are much more suit to the task.

Please note: I'm not saying you should not automate via Excel, just that it does not seem very fit to me for serving images through a (busy) web server.

About your question, I'd create the file and store it within a table with a key that's related to its information and a timestamp. If - to say - we are talking about stock data, I'd store a key like "XXX-60" to mean it's the stock symbol XXX and the graph is for 60 days. Then I'd store the blob with your GIF and a timestamp. On loading, I'd query the database for a "XXX-60" created within the last five minutes; if not found, I'd create it and replace the old version in the database. I would not go for "real" files; they're harder to keep track of, will fragment the file system, and you need a CGI with a database connection to serve the request in any case.

  • Comment on Re: Strategies for temporary image files in CGI

Replies are listed 'Best First'.
Re: Re: Strategies for temporary image files in CGI
by Itatsumaki (Friar) on Nov 21, 2003 at 17:16 UTC

    I mainly went with Excel for convenience: with enough time I'm pretty sure I could get GD to do what I needed (manually add & size error-bars, calculate a regression line, manually overlay graphs to add it, etc.). I guess I'll try adding a simple chart and see how Excel responds.

    I like the idea of storing the file in the DB, but won't I need to write that data to disk when I want to display it? If I try to embed it in an HTML page, I'll need a static link for that, will I not?