Page 1 of 1

Inserting a an image into blob field

Posted: Mon 06 Nov 2006 13:09
by classicmydac
Delphi 7.

I have an image path eg c:\test\image1.jpg

Previously I used MyTable_Ticket_Images.FieldByName('Image2').AsVariant := MyTable_DataUpload.FieldByName('PICTURE2').AsVariant;

as the image was in another table.

What is the code to insert into a blob field using the path.

Cheers

SteveE

Posted: Mon 06 Nov 2006 15:53
by Antaeus
Please see MyDAC Pictures demo. You can find this demo in %MyDAC%\Demos\Pictures directory.
%MyDac% is the MyDAC installation path on your computer.

Sorry, it's not working

Posted: Tue 28 Nov 2006 11:31
Hi Antaeus,
Antaeus wrote:Please see MyDAC Pictures demo. You can find this demo in %MyDAC%\Demos\Pictures directory.
%MyDac% is the MyDAC installation path on your computer.
It's not posible to insert a jpeg with this sample.

In Source Main.pas you must include the jpeg library. After that you are able to load jpeg's. But you are not able to save it to database...

Do you know, how to do this ???

Thanks for information
Uwe Beyer

Posted: Tue 28 Nov 2006 16:22
by Antaeus
> It's not posible to insert a jpeg with this sample.
It does not matter what kind of file do you try to load into the BLOB field. Probably the reason of this problem is the TDBImage component. Try to remove the link to the dataset field from TDBImage.

> But you are not able to save it to database...
What problem does happen when you try to post the record? Please specify the exact error message.

DBImage

Posted: Wed 29 Nov 2006 08:46
Sorry,

it was the DBImage component. After disconnection it works fine.
I have saved the jpeg to blob and it's ok.

Next I reconnected the DBImage and get the following error message:

Image

It's a german message, because we are developing in Switzerland...

We have the prof. version from DAC. Is it enouth, to include the jepg in
the header of the DBImage ?

Thanks
Uwe Beyer

Posted: Thu 30 Nov 2006 15:16
by Antaeus
This issue concerns the TDBImage component but not MyDAC. It does not matter to MyDAC what format is used to store data in the BLOB field (BMP, JPG, AVI, etc). MyDAC just returns a sequence of bytes.

> Is it enouth, to include the jepg in the header of the DBImage ?
This question is out of the MyDAC support scopes. Please ask it in the corresponding forum of the Borland site.
We think that it will be enough to include this unit into the project only once.

It's working

Posted: Fri 01 Dec 2006 09:10
Thank you for the information.

I have now a working solution. I have found a DBImage component, that is able to show jepg and gif.
Now I'm can load from file to longblob and show pictures directly without any additional code.

After that my understund for BLOB is more better :roll:

Thanks a lot again
Uwe Beyer, Wurmlingen