The picture example with jpegs?
The picture example with jpegs?
Is there any way to get JPEGS working with this?
Oki, as i understand it (now) DBimage (for delphi7) can not handle JPEG, thats probably why the demo have BMP pictures. But i found a freeware who did. A component called umDBImage. Works fine with MYDAC - only drawback i seen yet is that it cant handle som Jpeg formats like CONICA cameras and not gif, but everything jpg that photoshop creates works fine...
Perhaps include a data-aware picture component in mydac that can handle both JPEG and GIF? MySQL Developer Studio already can do this, so why not mydac to?
Perhaps include a data-aware picture component in mydac that can handle both JPEG and GIF? MySQL Developer Studio already can do this, so why not mydac to?
Oki i get it, thanx. Just one question - the BlobField: TBlobField on the "Pictures" examle is never instansiated. Misstake or ?
procedure TPicturesFrame.btLoadClick(Sender: TObject);
var
BlobField: TBlobField; // ******
begin
{$IFNDEF LINUX}
with TOpenPictureDialog.Create(nil) do
{$ELSE}
with TOpenDialog.Create(nil) do
{$ENDIF}
try
InitialDir := '.\Pictures';
if Execute then begin
if quPictures.State in [dsBrowse] then
quPictures.Edit;
BlobField := quPictures.FieldByName('Picture') as TBlobField; ****
BlobField.LoadFromFile(FileName);
end;
finally
Free;
end;
end;
procedure TPicturesFrame.btLoadClick(Sender: TObject);
var
BlobField: TBlobField; // ******
begin
{$IFNDEF LINUX}
with TOpenPictureDialog.Create(nil) do
{$ELSE}
with TOpenDialog.Create(nil) do
{$ENDIF}
try
InitialDir := '.\Pictures';
if Execute then begin
if quPictures.State in [dsBrowse] then
quPictures.Edit;
BlobField := quPictures.FieldByName('Picture') as TBlobField; ****
BlobField.LoadFromFile(FileName);
end;
finally
Free;
end;
end;
Thanx, i found it. Did have some trouble because all examples loaded from a file, and i wanted to get it straight out of mydac. I used a TmemoryStream, witch behaves different if load from file or load from a Tblobfield. In the first case pos of stream is 0 and in the later and end of stream. When i put pos to 0 it worked. Then i found out i not need a stream at all. Now it works.
procedure TForm1.ShowBlob;
var
jpg : TJpegImage;
blob : Tblobfield;
begin
blob := MyQuery1.FieldByName('Picture') as TBlobField;
if blob.BlobSize>0 then
begin
jpg:= TJpegImage.Create;
jpg.Assign(blob);
image1.Picture.Graphic:=jpg;
jpg.Free;
jpg:=nil;
end //of showing blob
else image1.Picture.Graphic:=nil; // no picture - clear the Timage
end;
Then i call "ShowBlob" from TmyQuerys after scroll event, and also when i load the image. I must use Timage, DBimage cant handle Jpeg and the freeware umDBimage cant handle more than a few JPEG versions.
procedure TForm1.ShowBlob;
var
jpg : TJpegImage;
blob : Tblobfield;
begin
blob := MyQuery1.FieldByName('Picture') as TBlobField;
if blob.BlobSize>0 then
begin
jpg:= TJpegImage.Create;
jpg.Assign(blob);
image1.Picture.Graphic:=jpg;
jpg.Free;
jpg:=nil;
end //of showing blob
else image1.Picture.Graphic:=nil; // no picture - clear the Timage
end;
Then i call "ShowBlob" from TmyQuerys after scroll event, and also when i load the image. I must use Timage, DBimage cant handle Jpeg and the freeware umDBimage cant handle more than a few JPEG versions.