On 21/05/12 14:58, Miah Gregory wrote:
To render the images directly from the database, you need to output an
appropriate mime type header then send the image data to the caller.
It's doable in cake, but you need to jump through a few hoops.
You certainly don't need to write the image to disk to serve it up to
the caller, that would be highly inefficient, and you'd be better off
writing the image to disk in the first place rather than storing in the
database if you were going that route.
As to whether serving up images directly from the database vs from the
file system via a php wrapper for access control is a sensible way to go
- that's a whole different discussion.
The bottleneck for database or disk images IMHO would be sending the
actual data in the response as is the case for all images. Reading the
image data from the database, I would argue, is less efficient than
reading it from disk since the server may well have clients competing
for database connections causing a bottleneck in itself.
I would suggest that a one-off database extraction then caching the
extracted image for a period of time and serving it from disk would be
more efficient (especially for high traffic images) than extracting it
from the database for each request.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php