<주의 사항>
이미지를 넣을때나 불러올때 DB연결 Componet(예>DBISAM,NEXUSDB,BDE,DevExpress,ADO,ODAC,UNIDAC등등)에 따라 약간의 차이가 발생할수 있습니다.
요즘은 뭐 저작권에 대한 분위기가 살벌하더군요.
-. DB에 이미지 저장하기
Uses JPEG <— 추가…
var
ImgStream : TMemoryStream;
JPG : TJPEGImage;
begin
Try
ImgStream := TMemoryStream.Create;
JPG := TJPEGImage.Create;
JPG.Assign( cxImage1.Picture.Graphic );
JPG.SaveToStream( ImgStream );
ImgStream.Position := 0;
Temp_SQL.ParamByName( 'Image' ).LoadFromStream( ImgStream, ftBlob );
Finally
JPG.free;
ImgStream.free;
End;
-. DB에 저장된 이미지 불러오기….
var
ImgStream : TMemoryStream;
begin
If not TBlobField( FieldByName('Image')).IsNull then
Try
ImgStream := TMemoryStream.Create;
cxImage1.Picture.Graphic := TJPEGImage.Create;
TBlobField( FieldByName('Image')).SaveToStream( ImgStream );
ImgStream.Position := 0;
cxImage1.Picture.Graphic.LoadFromStream( ImgStream );
Finally
ImgStream.free;
End;
end;
참고만 하시기 바랍니다.

최신 댓글