Inserting a an image into blob field
-
classicmydac
- Posts: 38
- Joined: Fri 23 Dec 2005 11:51
Inserting a an image into blob field
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
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
-
[email protected]
- Posts: 15
- Joined: Thu 23 Nov 2006 07:49
- Location: Switzerland
Sorry, it's not working
Hi Antaeus,
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
It's not posible to insert a jpeg with this sample.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.
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
> 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.
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.
-
[email protected]
- Posts: 15
- Joined: Thu 23 Nov 2006 07:49
- Location: Switzerland
DBImage
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:

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
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:

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
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.
> 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.
-
[email protected]
- Posts: 15
- Joined: Thu 23 Nov 2006 07:49
- Location: Switzerland
It's working
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
Thanks a lot again
Uwe Beyer, Wurmlingen
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
Thanks a lot again
Uwe Beyer, Wurmlingen