insert .jpeg files to Oracle

2019-08-03 07:59发布

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? Thanks in advance.

3条回答
smile是对你的礼貌
2楼-- · 2019-08-03 08:36

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

查看更多
做个烂人
3楼-- · 2019-08-03 08:37

Add jpeg to the uses clause.

uses
    jpeg;
查看更多
姐就是有狂的资本
4楼-- · 2019-08-03 08:45

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.

查看更多
登录 后发表回答