Posted by Andy Hassall on 08/17/05 21:41
On 16 Aug 2005 16:56:33 -0700, bissatch@yahoo.co.uk wrote:
>I am trying to upload an image, create a new file based on that image
>and then store the base64 encoded image data in a database.
A couple of suggestions for improvements:
MySQL can store binary data directly using the *BLOB types, which would avoid
the 33% size increase plus processing that you are incurring by base64 encoding
it.
You're writing the JPEG to a temporary file then reading back out again before
feeding into the database; another approach could be to use the output
buffering functions (ob_start() etc.) and then use imagejpeg without a filename
argument. You can then read the data out of the output buffer and into the
database without the intermediate temporary file.
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|