Hey.
I have an XML file and would like to use PHP to display the medium size only. The part of the XML looks like this:
<image size="small">/small23.png</image>
<image size="medium">/medium23.png</image>
<image size="large">/large23.png</image>
I’d like to display the image on the page using <img src="" />, but I’m not sure how to put only the medium image. Within a forloop going through all the other elements, I tried this:
if($file->image->attributes()->size == "medium")
echo "<img src=$file->image />";
but nothing is drawn.
thanks
Based on your example I assume you’re using SimpleXML, so try this: