Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Strategies for temporary image files in CGI

by l3nz (Friar)
on Nov 21, 2003 at 13:19 UTC ( #308876=note: print w/replies, xml ) Need Help??

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:
  • It was quite slow (but we can forgive this)
  • It often broke with no apparent reason
  • It was unable to cope with moderate-to-heavy concurrency
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?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://308876]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2020-07-09 02:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found