Cant get Dynamic Image (BLOB based) to work [message #162045] |
Wed, 17 May 2006 19:00 |
Rob Mellor![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=rmellor%40dsbox.com) Messages: 3 Registered: July 2009 |
Junior Member |
|
|
I am having problems retrieving and showing a dynamic image using BIRT. I
have a mediumblob column in my mysql database which contains base64
encoded images (jpegs mostly). I try placing the "Image->Dynamic" and
binding it to an appropriate dataset, then placing that in a List->details
band. I also tried placing the Dynamic Image inside of the context of a
Table->details band with no luck. I get red X boxes appearing for every
image. So, it seems like it is correctly getting the data back from the
DB, but it fails to actually render the image? For each image I am
testing by displaying its GUID in one column and the Dynamic Image in the
other. The GUID column successfully shows the image's GUID but the
Dynamic Image always appears as the X invalid image button.
Any help would be appreciated... Has anyone gotten this to work properly?
"mediumblob" should be essentially a "blob" datatype, just of different
size.
Here is my mysql table and some code I use on the php side to
insert/encode and then extract/decode/show image to user. The image is
displayed correctly in my web application using the code below:
CREATE TABLE image (
ImageID int(11) NOT NULL auto_increment,
Image mediumblob
...
)
The image is inserted into the mysql database via php:
$image = base64_encode($data);
$image is then inserted.
To view as part of a webpage:, I do the following (in php) & present the
image as part of a webpage:
Header("Content-type: image/jpeg");
require_once "db.php";
DB_Connect();
$sql = "SELECT Image FROM image WHERE ImageID=$image";
$result = DB_Query($sql);
if(!$result)
echo "Error during query; $sql";
$myrow = DB_Fetch_Array($result);
$blaa = base64_decode($myrow[0]);
echo "$blaa";
|
|
|
Powered by
FUDForum. Page generated in 0.02254 seconds