Extract base64 encoded images from XML file

<?php
$this->xml = simplexml_load_file('images.xml');
 foreach ($this->xml->Listing->Picture as $picture) {
        $filename = $this->cleanBrackets($picture->PictureID) . ".jpg";
        //open file for writing
        $this->image_handle = fopen("xml/images/". $filename , "wb+") or die('error file write');
        $data = base64_decode(trim($picture->BinaryData));
        @fwrite($this->image_handle,$data);
        fclose($this->image_handle);
    } // end foreach
?>
   
Comments are closed.