Jump to content

Delphi 2010 mysql picture blob field TUniDBImage Bitmap is not valid


Astrolab

Recommended Posts

next code works with tUniImage component,but i want do it with tUniDbImage.

 

procedure TMainForm.UniDBGrid1CellClick(Column: TUniDBGridColumn);

var

JpegImage: TJPEGImage;

BlobStream: TStream;

begin

with UniServerModule do begin

if (not UniQuery1.FieldByName('picture').IsNull) then

begin

BlobStream := UniQuery1.CreateBlobStream(UniQuery1.FieldByName('picture'),bmRead);

JpegImage := TJPEGImage.Create;

try

JpegImage.LoadFromStream(BlobStream);

UniImage1.Picture.Assign(JpegImage);

UniImage1.Visible := True;

finally

JpegImage.Free;

BlobStream.Free;

end;

end

else

UniImage1.Visible := False;

end;

end;

Link to comment
Share on other sites

  • 6 months later...

Hi Farshad,

 

I need jpg image upload with uniDBImage...

 

Delphi XE2, MsSQL2008, Devart Unidac

 

UniFileUpload + tUniDBimage

 

I can upload BMP image but not JPG image!

 

it shows error "Bitmap is not valid".

 

It is Delphi2010,mysql(devaart unidac) configuration,

I put tUniDBimage on form ,

set datasource,

and when i set datafield which is image-blob field from TUniQuery

it shows error "Bitmap is not valid".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...