You are here: Re: First attempt at uploading image and storing to db « PHP Programming Language « IT news, forums, messages
Re: First attempt at uploading image and storing to db

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация