Re: Images in PHP and MySQL
| From: | Daniel Watrous | Date: | Mon, 27 Sep 2004 22:38:41 +0000 |
| Subject: | Re: Images in PHP and MySQL | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198029@lists.php.net to get a copy of this message | ||
I don't. I have used it on several projects. One caveat I would offer is that this is much slower than one might think. Three possible advantages come from using this approach:
1) there is no need to fiddle with directory permissions to write images.
2) if the content is sensitive you have the added security of the database password (and the fact that the database is ususally not directly accessible).
3) a mysqldump gives a backup of all images along with other persistent data
Other disadvantages follow:
1) excessive load on the server for loading each image
2) the load mentioned above causes a slow down in the script
3) images usually need to be written to file before using GD for manipulation, inclusion in PDFs, etc.
I have found that when I decide to store image data in the database I will usually also store a copy of the image on the server (as a file) also, primarily for performance reasons.
----- Original Message ----- From: "GH" <GaryHotko@gmail.com>
To: "Daniel Watrous" <nos_pamdan@hotmail.com>
Cc: "GH" <garyhotko@gmail.com>
Sent: Monday, September 27, 2004 4:31 PM
Subject: Re: [PHP] Images in PHP and MySQL
Do you know of a good tutorial on this topic. On Mon, 27 Sep 2004 16:25:15 -0600, Daniel Watrous <nos_pamdan@hotmail.com> wrote:consider using a blob field type. you will need to prepare your data on the way in, but not on the way out of DB: $content = addslashes(fread(fopen($_FILES["imgb_sizedesc"]["tmp_name"], "r"), filesize($_FILES["imgb_sizedesc"]["tmp_name"]))); then instert $content into your DB using insert! ----- Original Message ----- From: "GH" <GaryHotko@gmail.com> To: "php-general" <php-general@lists.php.net> Sent: Monday, September 27, 2004 4:19 PM Subject: [PHP] Images in PHP and MySQLI was wondering how to get images into and out of a Mysql database with in php... I do not have anything in my book... but was told it was possible. I have PHP 4.3.4 and mysql 4.0.18 Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php