EXCELLENT !!! TYhansk HEAPS Ben. This is Exactly what I am looking for !!
Although, I seem to still have a slight problem. When I open teh page that goes and
gets teh image, it takes a long time to come back, and I think it actually times out.
heres my Delphi code :-
(I use a jpg not a gif)
function Timg.Imagetest: OleVariant;
var
Bmp : TBitmap;
m : TMemoryStream;
j : TJpegImage;
begin
Bmp := TBitmap.create;
j := TJpegImage.create;
m := TMemoryStream.create;
bmp.loadFromfile('c:\winnt\Greenstone.bmp');
j.assign(bmp);
j.savetostream(m);
Result:=StreamToVariant(m);
m.free;
bmp.free;
end;
then the ASP code is :-
<%
Option Explicit
Response.Expires = -1
Response.ContentType = "image/jpeg"
dim obj
dim vntGraph
set obj=server.createObject("imgtest.img")
vntGraph = obj.Imagetest
Response.BinaryWrite vntGraph
' Response.End
%>
Anything stand out what I am doing wrong ?
Thanks again, Jeremy Coulter
<PRE>
hi!
this is what i use to send a .gif from delphi>browser (after doing
image.SaveToStream):
function StreamToVariant(const aStream:TStream):Variant;
var
Buffer:Pointer;
Size:integer;
begin
Result := null;
Assert(aStream<>nil);
Assert(aStream.Position=0);
Size:=aStream.Size;
Result:=VarArrayCreate([0, Size-1], varByte);
try
Buffer:=VarArrayLock(Result);
aStream.ReadBuffer(Buffer^, Size);
finally
VarArrayUnLock(Result);
end;
end;
you'll also need to do this in the asp that reurns the image/whatever.
Response.Buffer = TRUE
Response.Clear
Response.ContentType = "image/gif"
Response.BinaryWrite vntGraph
Response.End
Cya
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
</PRE>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"