hi I inserted into oracle database image file on delphi7 with OpenPictureDialog1. All files are .bmp I want to insert .jpeg(.jpg) files. How can I insert this? T开发者_运维知识库hanks in advance.
Add jpeg to the uses clause.
uses
jpeg;
convert bmp to jpg
function BMPtoJPG
(var BMPpic, JPGpic: string):boolean;
var Bitmap: TBitmap;
JpegImg: TJpegImage;
begin
Result:=False;
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile(BMPpic) ;
JpegImg := TJpegImage.Create;
try
JpegImg.Assign(Bitmap) ;
JpegImg.SaveToFile(JPGpic) ;
Result:=True;
finally
JpegImg.Free
end;
finally
Bitmap.Free
end;
end;
Usage: BMPtoJPG('mybitmap.bmp','myjpeg.jpg')
very useful link about jpeg unit
http://www.hamslab.com/lab/delphi/jpeg/jpeg_del.html
how to send jpeg to oracle
1) save jpeg to a file.
2) here you have how to save a file to Oracle:
http://www.delphi3000.com/articles/article_1523.asp?SK=
best regards,
Radu
FWIW, unless Jpeg is a requirement, I would use PNG for storage. Jpeg will lose quality in compression. It will be ok for photos, but for diagrams, screenshots, or anything with text, quality will suffer.
精彩评论