I have done the following code to extract an image from a URL, but I am getting an XML parsing error. How do I show an image with all XML output?
$error = true;
$msg = 'profile';
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
if($error)
{
echo "<response>";
echo "<success>S</success>";
echo "<message>".trim($msg)."</message>";
echo "<userid>".trim($userid)."</userid>";
echo "<username>".trim($username)."</username>";
echo "<firstname>".trim($firstname)."</firstname>";
echo "<lastname>".trim($lastname)."</lastname>";
echo "<email>".trim($email)."</email>";
echo "<follower>".trim($follower)."</follower>";
//echo "<photo><img src=photo/".trim($photo) ." height='200' width='200'></photo>";
echo "</response>";
}
An XML cannot use an <img src=…> tag to display images. That is a HTML tag. You can have an URL to the image which your application can read and then render, but that is application-specific (i.e. browser, mobile phone, or desktop application) – which is the point of XML, it’s generic and not tied down to a single application.