Subject | Am I doing this right ? (GIFs in BLOb to show on the web) |
---|---|
Author | Claus Thor Barth |
Post date | 2001-11-13T17:00:45Z |
Hi There,
I hope you can help me. I use D5 and IB6.
I have created a table where I want to store some GIF-images in the BLOb
fields :
CREATE TABLE CUSTOMER (
USERID VARCHAR( 20 )
, PWORD VARCHAR( 20 )
, CUSTOMER_NAME VARCHAR( 50 )
, CF FLOAT
, KHZ FLOAT
, POWER FLOAT
, HOUR_I BLOB( 65535, 2 )
, HOUR_O BLOB( 65535, 2 )
, DAY_I BLOB( 65535, 2 )
, DAY_O BLOB( 65535, 2 )
, WEEK_I BLOB( 65535, 2 )
, WEEK_O BLOB( 65535, 2 )
)
I store the images with this code :
if h=1 then BLOBos := 'hour_'+LinkType
else if h=2 then BLOBos := 'day_'+LinkType
else if h=3 then BLOBos := 'week_'+LinkType;
ib_cursor1.sql.clear;
ib_cursor1.SQL.add('update customer set '+BLOBos+' = :image where
upper(userid) = "'+NewFileName+'"');
ib_cursor1.Prepared := true;
ib_cursor1.Params.ParamByName('image').LoadFromFile(lpath+'\'+NewfileName+Li
nkType+'.gif');
ib_cursor1.execute;
What this code do is ofcourse to find the right image file on the disk and
insert this into the right blob field.
This seems to go ok.
I now want to generate a html page that shows the image.
imagelisten := imagelisten + '<IMG SRC="./getimage" border="0">';
and
procedure TWebModule1.WebModule1WebActionItem3Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
S : TMemoryStream;
begin
S := TMemoryStream.Create;
pwControlhour_i.SaveToStream(s);
S.Position := 0;
Response.ContentType := 'image/gif';
Response.ContentStream := S;
Response.SendResponse
end;
My problem is now that the image is NOT shown on the web side ?!?
Everything else that I want to show on that page is shown ok....
Can you find anything that I am doing wrong ?
TIA
/Claus
I hope you can help me. I use D5 and IB6.
I have created a table where I want to store some GIF-images in the BLOb
fields :
CREATE TABLE CUSTOMER (
USERID VARCHAR( 20 )
, PWORD VARCHAR( 20 )
, CUSTOMER_NAME VARCHAR( 50 )
, CF FLOAT
, KHZ FLOAT
, POWER FLOAT
, HOUR_I BLOB( 65535, 2 )
, HOUR_O BLOB( 65535, 2 )
, DAY_I BLOB( 65535, 2 )
, DAY_O BLOB( 65535, 2 )
, WEEK_I BLOB( 65535, 2 )
, WEEK_O BLOB( 65535, 2 )
)
I store the images with this code :
if h=1 then BLOBos := 'hour_'+LinkType
else if h=2 then BLOBos := 'day_'+LinkType
else if h=3 then BLOBos := 'week_'+LinkType;
ib_cursor1.sql.clear;
ib_cursor1.SQL.add('update customer set '+BLOBos+' = :image where
upper(userid) = "'+NewFileName+'"');
ib_cursor1.Prepared := true;
ib_cursor1.Params.ParamByName('image').LoadFromFile(lpath+'\'+NewfileName+Li
nkType+'.gif');
ib_cursor1.execute;
What this code do is ofcourse to find the right image file on the disk and
insert this into the right blob field.
This seems to go ok.
I now want to generate a html page that shows the image.
imagelisten := imagelisten + '<IMG SRC="./getimage" border="0">';
and
procedure TWebModule1.WebModule1WebActionItem3Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
S : TMemoryStream;
begin
S := TMemoryStream.Create;
pwControlhour_i.SaveToStream(s);
S.Position := 0;
Response.ContentType := 'image/gif';
Response.ContentStream := S;
Response.SendResponse
end;
My problem is now that the image is NOT shown on the web side ?!?
Everything else that I want to show on that page is shown ok....
Can you find anything that I am doing wrong ?
TIA
/Claus