Makes perfect sense. When you use matplotlib you can do:
You can store the image in temp file: import tempfile f = tempfile.NamedTemporaryFile() canvas = FigureCanvas(figure) canvas.print_png(f) filename = f.name f.close() then move it to the db in a field called for example file of type upload db.table.insert(file = db.table.file.store(filename=filename) then read the file, delete, and return the image data = open(filename,'rb').read() os.unlink(filename) return data On Wednesday, 4 April 2012 13:50:12 UTC-5, dancer` wrote: > > Hello, > > I'm on the newer end of programming, and web2py has been my first (and > very happy) foray into web application development. I am developing an > application to remotely control two spectrum analyzers (HP 3562A) in our > lab to do swept sine and power spectra plots. The connection is made using > sockets, and the data is dumped, modified, and plotted using numpy, scipy > and matplotlib. The examples I have found that do this do not mention how > to store the resulting plots on disk but rather plot in real time when > required. What I would like is to have a results table with all the run > parameters (for both sweeps and PSD) and have a thumbnail image (I know how > to generate a thumbnail if I have a parent file) that links to the original > plotted image. Is this possible, or am I approaching this the wrong way? > > Thank you. >