Php 在链接中显示来自xml的图像

Php 在链接中显示来自xml的图像,php,xml,Php,Xml,当我从xml文件中读取图像时,如何在链接中显示它?例如,使用此代码: img.php $what = 'ResourceLink'; $reader = new XMLReader(); $reader->open('http://www.file.xml/getRecordsX.do?user=user01&password=password01&identifier=978841580114-6&metadataformat=ONIX&version

当我从xml文件中读取图像时,如何在链接中显示它?例如,使用此代码:

img.php

 $what = 'ResourceLink';

$reader = new XMLReader();
$reader->open('http://www.file.xml/getRecordsX.do?user=user01&password=password01&identifier=978841580114-6&metadataformat=ONIX&version=3.0');
while ($reader->read()) {
    if ($reader->nodeType == XMLReader::ELEMENT) {
        $exp = $reader->expand();
        if ($exp->nodeName == $what)
            echo '<img src="' . $exp->nodeValue .' " height="15%" width="15%" />';
    }
}

不知道你的意思!您是否能够显示图像并只想将其转换为链接?link.php与img.php的关系如何?我想OP是在问如何从php脚本提供图像。例如,
标题('Content-Type:image/jpeg')。误导性的部分是

<img class="foto" src="img.php?id=9788477828921" width="70" title="TIERRA VISTA DESDE EL CIELO, LA" alt="TIERRA VISTA DESDE EL CIELO, LA" border="0">';
$id = $_GET['id'];
$what = 'ResourceLink';
$reader = new XMLReader();
$reader->open('http://file.xml/getRecordsX.do?user=user01&password=pass01&identifier='.$id.'&metadataformat=ONIX&version=3.0');
while ($reader->read()) {
    if ($reader->nodeType == XMLReader::ELEMENT) {
        $exp = $reader->expand();
        if ($exp->nodeName == $what)
           $img = $exp->nodeValue;
    }}
header('Content-Type: image/jpg');
readfile($img);