> > Hi, > your understanding is correct, photos are under protected folders. and the > scaling will be a problem, but do you think it is good to store photo in > the > database's blob field? and every rendering requires copying from database > to > a temporary file?
You can spool the data from a BLOB straight back to the client without having to store it in a file first. You don't even need to fully load it into memory. Im using Hibernate + PostgreSQL in my projects. Here's a short example of a StreamResponse that returns a binary stream from a Blob. public InputStream getStream() throws IOException { [...] Blob blob = // SOME_RECORD.getData(); if(blob == null) { [...] } try { return blob.getBinaryStream(); } catch (SQLException e) { [...] } } Storing binary data in blobs makes a lot of things easier and we've never had any problems with it so far. You can always setup a database replication scheme to increase the database performance if you have an awful lot of visitors. regards, Onno