Forum Moderators: coopster
I know how to SELECT the blob from my SQL database.
But how do I create an Imagick object out of the data?
All the Imagick methods I see load their contents from a file.
[php.net...]
how so?
I chose database because it's easy, images are easily read/written, they stay associated with their row ID (which contains other info too). And I don't have to keep track of file names or deal with File I/O, naming conventions. At a max size of 500px with thumbs at 120x120 and 40x40, the blobs aren't very big.
There are likely just as many reasons not to do it that way. Scalability is a concern. Some day I might want to keep my blobs in a storage cloud instead of in my relational db. Some day.
Also, this way I don't need to worry about a malicious user-uploaded "image" finding its way onto my web server, with whatever viruses or malware hitching a ride, security is tighter, simpler, less loopholes and potential (or imagined) vulnerabilities.
But I do know that I never again want to build a site that hosts 100,000 little JPG files on the server. FTP upload, download, backup & syncing are annoyingly slow when you have to wait 8 hours for all your images to move from one machine to another.
One of those things I've absorbed and forgot why.