I had a php function to get all image from a blob field.
As below:
$db_corp = new PDO ("firebird:dbname=DATA.FDB;host=localhost", "sysdba", "masterkey");
$query_corp1= "Select CODPROD, ,FOTO From PRODUCT";
$result_corp1 = $db_corp->prepare($query_corp1);
$result_corp1->execute();
$result_corp1->bindColumn(1, $corp1_CODPROD);
$result_corp1->bindColumn(9, $corp1_FOTO, PDO::PARAM_LOB);
while($result_corp1->fetch()){
if($corp1_FOTO){
file_put_contents($corp1_CODPROD.".png",$corp1_FOTO);
}
}
The script runs well and takes almost half of the photos in the database, but in the process i got following error.
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 480055 bytes)
I already tried gc_enable(); and gc_collect_cycles; My database has 2100 products but half have pictures and I need to extract it to a files.
Thanks in advancer
memory_limit, which appears to be currently set to128Mwhileloop? Or do you get the error during the execute? I believe from how you state it that you get it during the loop, just want to clarify.