Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I posted an answer to your related question here: <a href="https://stackoverflow.com/questions/3490740/pulling-images-from-rss-atom-feeds-using-magpie-rss/4236335#4236335">Pulling Images from rss/atom feeds using magpie rss</a></p> <p>To apply that answer to your code above, first make the changes to rss_parse.inc as per my previous answer. Then you can simply access the image urls via Magpie (instead of having to write any extra functions) e.g.</p> <pre><code>// Your code @$rss = fetch_rss($rsso-&gt;url); if (@$rss) { $items=$rss-&gt;items; foreach ($items as $item ) { if (isset($item['title'])&amp;&amp;isset($item['description'])) { // START MY EDIT if (isset($item['enclosure_type']) &amp;&amp; isset($item['enclosure_url'])){ switch ($item['enclosure_type']){ case "image/gif": case "image/jpeg": case "image/png": $image_url=$item['enclosure_url']; $image_length=$item['enclosure_length']; break; } } //END MY EDIT } } } </code></pre> <p>And that's it! You just have to use the $image_url var to display your image (in an img tag of course :-)</p> <p>I have only checked for jpg, gif and png images in the code above as they're the most popular, but you can add other mime-types to the switch if you need to. Just be aware that the enclosure type is set by the creator of the RSS feed and not read from the file, so it may not be accurate. You might want to use exif_imagetype() on the image file itself to ensure it actually is an image.</p> <p>Hope this helps if its not too late!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload