From:             businessitconsulting at yahoo dot com
Operating system: Linux
PHP version:      5.3.1
PHP Bug Type:     Variables related
Bug description:  Displaying multiple images, BLOB data, from a MySQL database

Description:
------------
Need to display multiple images stored as BLOB data types in a MySQL
table. Using a while loop, other fields in the same table with text data
type, displays in a browser showing all rows when the BLOB field is not
included.

The BLOB data (the images), often are displayed as binary data but needs
to show as actual images.

Apparently there is an issue with PHP with displaying the binary data
stored in a variable directly as an image when echoing or printing the
variable with BLOB data using echo $TheBlobData; or print $TheBlobData;.

In some instances, the query executes, retrieves all rows but only
displays an image, instead of all the images per row.

Storing the images in directories has security issues, other risk and the
BLOB data needs to be stored and pulled directly from the database.


--------------------
Field Name, DataType
---------------------
ID, int
Picture, BLOB
Type, VARCHAR

For example this prints the ID of each row:
while ($rows = mysql_fetch_row($result))
{
echo $rows->ID;
}
and this prints the image Type stored in a field of each row

while ($rows = mysql_fetch_row($result))
{
echo $rows->Type;
}

but this prints each row of the images as binary data but needs to print
actual images:

while ($rows = mysql_fetch_row($result))
{
echo $rows->Picture;
}

When inserting the header() function to describe the image data type, it
only prints an image using the same while loop, in some cases it simply
shows a blank page and echos the address of the page:

while ($rows = mysql_fetch_row($result))
{
header ();
echo $rows->Picture;
}

This requires printing the multiple BLOB data directly as images to a page
for each row in a table and not just an image on the page. For users of
Postgres SQL, is this also an issue and are they open source databases
where BLOB data types can be displayed directly as images by echoing or
printing the BLOB data variable?


-- 
Edit bug report at http://bugs.php.net/?id=50467&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50467&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50467&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50467&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50467&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50467&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50467&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50467&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50467&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50467&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50467&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50467&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50467&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50467&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50467&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50467&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50467&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50467&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50467&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50467&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50467&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50467&r=mysqlcfg

Reply via email to