INDEX

PHP - Output image files from XML

Sample code to output the image file from XML

< ?
$xml = "test01.xml";
$xmlData = simplexml_load_file($xml);

foreach ($xmlData->img as $img) {
    $title  = $img->title;
    $fname = $img->fname;
    $imgtxt = $img->imgtxt;
}

$imgtxt_base64_decode = base64_decode($imgtxt);
file_put_contents($fname,$imgtxt_base64_decode);
echo "title:" . $title . "< br />";
echo "filename:" . $fname . "< br />";
echo "< img src = '" . $fname . "' />";
?>


Copyright(c) 2007-2024 coding.dojeun.com All Rights Reserved.