insert .jpeg files to Oracle

2019-08-03 08:37发布

问题:

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.

回答1:

Add jpeg to the uses clause.

uses
    jpeg;


回答2:

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:

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.