RE: [PHP] Images in PHP and MySQL
| From: | Jay Blanchard | Date: | Thu, 30 Sep 2004 20:34:16 +0000 |
| Subject: | RE: [PHP] Images in PHP and MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-198343@lists.php.net to get a copy of this message | ||
[snip]
HEre is a question that I have been wondering about:
- Does the image file use more space in the db or as a file itself
(Do Not count the extra data that one would store in the db along with
the image... ie. ID number)
[/snip]
While better asked on a SQL list, I'll give you an answer from
http://dev.mysql.com/doc/mysql/en/Storage_requirements.html
"VARCHAR and the BLOB and TEXT types are variable-length types. For
each, the storage requirements depend on the actual length of column
values (represented by L in the preceding table), rather than on the
type's maximum possible size. For example, a VARCHAR(10) column can hold
a string with a maximum length of 10 characters. The actual storage
required is the length of the string (L), plus 1 byte to record the
length of the string. For the string 'abcd', L is 4 and the storage
requirement is 5 bytes.
The BLOB and TEXT types require 1, 2, 3, or 4 bytes to record the length
of the column value, depending on the maximum possible length of the
type."