Subject Re: Fw: about store images files
Author perevilas
Hello,

This is a Delphi question, not firebird, but

{* * * * * * * * *
Clipboard to image
}

c:=TClipBoard.create;
try
if clipboard.hasFormat(CF_BITMAP) then
image.LoadFromClipboardFormat(
CF_BITMAP,
c.getAsHandle(CF_BITMAP),
0);
else
showMessage('El clipboard no contiene un gráfico');
finally
c.free;
end;


{* * * * * * * * *
Image to dataset }

if (image.bitmap.empty=false) then
begin
ds.insert;
Jpeg:=TJpegImage.create;
data:=TMemoryStream(
ds.createBlobStream(
ds.fieldbyname('imagen'), bmWrite));

try
jpeg.assign(image.bitmap);
jpeg.saveToStream(data);
data.seek(0,soFromBeginning);
finally
begin
data.Free;
Jpeg.Free;
end;
end;
ds.post;
end; //endif (image.bitmap.empty=false)



{* * * * * * * * *
Dataset to image
}
Jpeg:=TJpegImage.create;
data:=TMemoryStream(
ds.createBlobStream(
ds.fieldbyname('imagen'), bmRead));

try
data.Seek(0,soFromBeginning);
Jpeg.LoadFromStream(data);
image.bitmap.width:=jpeg.width; //important
image.bitmap.height:=jpeg.height;
image.bitmap.canvas.draw(0,0,jpeg);
finally
begin
data.Free;
Jpeg.Free;
end;
end;






--- In firebird-support@yahoogroups.com, ÄÅÂÇÓ ÐÅÔÑÏÓ <devis@i...>
wrote:
>
> ----- Original Message -----
> From: "Petros Devis" <devis@i...>
> Newsgroups: egroups.ib-support
> Sent: Thursday, November 27, 2003 12:57 PM
> Subject: about store images files
>
>
> > Hello all
> > I'm trying to store images files into a firebird table.
> > I declared a column , say , imgcol of type BLOB and inside a
DELPHI form I
> > used a TDBImage control to hold the image.
> > The problem is that when I'm running the program with the form ,
I have
> not
> > a way to put the image in the TDBImage control . The copy and
past method
> > which easy somebody can use with paradox tables is not working
now. What
> is
> > going wrong?
> > I will be appreciate for any help
> >
> > Petros Devis
> >
> >