Subject | how to insert image blob in Firebird in PHP and ADODB |
---|---|
Author | |
Post date | 2014-01-21T18:30:25Z |
I have done it in Delphi, but now i have the same problem finding how to do it in PHP.
I searched two days.
I need to store image in the database and not as a file on the server.
i have set blob field to subtype -1.
i first do base64_encode for the file in PHP and then try to insert it in SQL.
But get error:
General error: -413 filter not found to convert type 1 to type -1
The code is:
$imgSrc='testimage.jpg');
$img_src = $imgSrc;
$imgbinary = fread(fopen($img_src, "r"), filesize($img_src));
$img_str = base64_encode($imgbinary);
$sql="insert into info (ID,LOGO) values('1','$img_str')";
I think it has to do something with the header type. as JPG or something.
this only gives error.
and i just can't find any examples on net.
is there anyone that have an example to how to do it in PHP?
i really need help on this.