php-skript zum extrahieren von jpegs aus cib-file
Ich hab das folgende PHP-Skript im Netz gefunden, welches ein cib-File hernimmt und daraus jpeg's extrahiert. Nun bin ich kein php-guru und bekomme folgende Fehlermeldung beim ausführen des programms:
F:\>php runme.php
PHP Fatal error: Allowed memory size of 104461000 bytes exhausted (tried to allocate 1044618942 bytes) in F:\runme.php
Das zu entpackende File hat 1 GB, offenbar gibt es Speicherprobleme. Wie bekomme ich die Sache in den Griff bzw. was macht das Skriptl genau ?
Der ursprüngliche Auto ist nicht zu erreichen !
<?php
ini_set("memory_limit","128M"); # passt das an eure Karte an, wenn nötig
$image = "card_image.cib"; # Das Imagefile
$x = implode("",file($image));
$jpgstring = chr(255).chr(216).chr(255).chr(224).chr(0).chr(16) ."JFIF";
$eop = chr(255).chr(217);
$i = 0;
while (strpos($x,$jpgstring))
{
$i++;
$beginn = strpos($x,$jpgstring);
$rest = substr($x,$beginn+strlen($jpgstring),strlen($x));
$ende = strpos($rest,$eop);
$bild = substr($x,$beginn,($ende-$beginn));
$x = $rest;
$bfile = fopen($i.".jpg","wb+");
fwrite($bfile,$bild);
fclose($bfile);
echo "Bild ".$i." wieder hergestellt.
";
$bild = "";
}
?>
|