Advanced Search

Results 1 to 7 of 7

Thread: Getting a certain image from a feed

  1. #1
    Join Date
    Apr 2011
    Posts
    23
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default Getting a certain image from a feed

    Hi,

    First of all i'm using Simple Pie to get the images from my feed, but the problem is that the images are blurry. (http://netti-tv.net/yle) Is there a way to get a certain image from the feed (http://areena.yle.fi/tv/kaikki.rss)? In my case I would like to get the image ending "160.jpg".

    Code what i'm using now is: http://pastebin.com/GCPXrkTQ and the part what is fetching the image is in line 88-89.
    PHP Code:
    $enclosure $item->get_enclosure();
    $i['kuva'] = $enclosure->get_thumbnail(); 
    Hopefully somebody can help! I would really appreciate it.

  2. #2
    Join Date
    Apr 2011
    Posts
    23
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Is there a solution for my problem for example using php array?

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,882
    Thanks
    16
    Thanked 288 Times in 287 Posts
    Blog Entries
    4

    Default

    The script is pulling the thumbnail image that is associated with each news item - are you wanting it to pull a different image for each news item? Possibly a larger version?

    And where does the "160.jpg" come in to play? Is that a common suffix for your larger version images? In other words, do you always use a series of thumbnail images with, for example, a "news-item-01.jpg" naming convention, and a larger version image series using a 160 suffix, as in "news-item-01-160.jpg"? I see that 160 is the img width declared in the original script echo (presumable when you say the image is blurry it is with reference to the script upsizing a much smaller source pic) but you haven't explained precisely why you mentioned it in your original post.

    For reference to others, the script displays the the image thumbnail like this;
    Code:
    echo '<img border="0" title="'.$item['content'].'" width="160" src="'.$item['kuva'].'"/></a>';
    Please explain your problem and requirements more clearly and then somebody might be able to offer suggestions.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  4. The Following User Says Thank You to Beverleyh For This Useful Post:

    X-Tream (02-10-2013)

  5. #4
    Join Date
    Apr 2011
    Posts
    23
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    First of all thank you Beverleyh for answering my question.

    Yes, I would like it to pull a larger image from the rss feed. Now it fetches the first image from the feed (Marked as Green and I would like to fetch the one ending in 160.jpq (Marked as red)): http://areena.yle.fi/tv/kaikki.rss

    Code:
    <item>
    <title>
    <![CDATA[ Yle Uutiset viittomakielellä: 10.02.2013 16.55 ]]>
    </title>
    <media:credit role="production department">Yle TV1</media:credit>
    <areena:tvLicense>false</areena:tvLicense>
    <link>http://areena.yle.fi/tv/1789751</link>
    <guid isPermaLink="false">6b9365aef11e4db1a3121f6046093ad5</guid>
    <description>
    <![CDATA[ ]]>
    </description>
    <pubDate>Sun, 10 Feb 2013 16:55:00 +0200</pubDate>
    <category>Uutiset</category>
    <itunes:image href="http://areena.yle.fi/static/mk/images/previews/6b/6b9365aef11e4db1a3121f6046093ad5/6b9365aef11e4db1a3121f6046093ad5_1360508971754_720.jpg"/>
    <media:thumbnail url="http://areena.yle.fi/static/mk/images/previews/6b/6b9365aef11e4db1a3121f6046093ad5/6b9365aef11e4db1a3121f6046093ad5_1360508971754_65.jpg" width="65" height="37"/>
    <media:thumbnail url="http://areena.yle.fi/static/mk/images/previews/6b/6b9365aef11e4db1a3121f6046093ad5/6b9365aef11e4db1a3121f6046093ad5_1360508971754_160.jpg" width="160" height="90"/>
    <media:thumbnail url="http://areena.yle.fi/static/mk/images/previews/6b/6b9365aef11e4db1a3121f6046093ad5/6b9365aef11e4db1a3121f6046093ad5_1360508971754_220.jpg" width="220" height="124"/>
    <media:thumbnail url="http://areena.yle.fi/static/mk/images/previews/6b/6b9365aef11e4db1a3121f6046093ad5/6b9365aef11e4db1a3121f6046093ad5_1360508971754_620.jpg" width="620" height="349"/>
    <media:thumbnail url="http://areena.yle.fi/static/mk/images/previews/6b/6b9365aef11e4db1a3121f6046093ad5/6b9365aef11e4db1a3121f6046093ad5_1360508971754.jpg" width="700" height="394"/>
    <media:thumbnail url="http://areena.yle.fi/static/mk/images/previews/6b/6b9365aef11e4db1a3121f6046093ad5/6b9365aef11e4db1a3121f6046093ad5_1360508971754_720.jpg" width="720" height="405"/>
    <dcterms:subject>
    <![CDATA[ Yle Uutiset viittomakielellä ]]>
    </dcterms:subject>
    <dcterms:valid>
    start=2013-02-10T16:55:00+0200; end=2013-03-12T23:59:59+0200; scheme=W3C-DTF;
    </dcterms:valid>
    <media:content duration="270"/>
    </item>
    And the "160.jpq" comes from the feed, as the feed has 6 thumbnails with different widths. So in my case 160 px width would be perfect for my site -> I should somehow grab the thumbnail ending in "160.jpg"

    The reason why the image is blurry is course the line:

    Code:
    echo '<img border="0" title="'.$item['content'].'" width="160" src="'.$item['kuva'].'"/></a>';
    Stretches the image bigger. From 65px -> 160px. To avoid this from happening I should somehow get the correct image size from the rss feed...And I believe you could somehow get it by using array?

    Anyways sorry for my bad English, but yet again I would really appreciate if somebody could help me.

  6. #5
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,882
    Thanks
    16
    Thanked 288 Times in 287 Posts
    Blog Entries
    4

    Default

    Ok - I'm on iPhone so I can't do any testing, but if your small (green) image always ends with "_65.jpg", and your bigger (red) image always ends with "_160.jpg", you can probably get away with doing something like this - add the extra line;
    Code:
    $enclosure = $item->get_enclosure();
    $i['kuva'] = $enclosure->get_thumbnail();  
    
    $i['kuva'] = str_replace('65.jpg', '160.jpg', $i['kuva']);
    Last edited by Beverleyh; 02-10-2013 at 04:06 PM.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  7. The Following User Says Thank You to Beverleyh For This Useful Post:

    X-Tream (02-10-2013)

  8. #6
    Join Date
    Apr 2011
    Posts
    23
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much Beverleyh! It's finally fetching the correct image.

  9. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,882
    Thanks
    16
    Thanked 288 Times in 287 Posts
    Blog Entries
    4

    Default

    No problem
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

Similar Threads

  1. Rss and Xml feed for DD?
    By keyboard in forum The lounge
    Replies: 5
    Last Post: 10-24-2012, 05:38 AM
  2. Replies: 3
    Last Post: 08-29-2012, 05:34 PM
  3. Replies: 0
    Last Post: 10-19-2011, 03:35 PM
  4. RSS Feed Reader (gfeedfetcher) isn't updating second feed
    By kellyrnh in forum Dynamic Drive scripts help
    Replies: 15
    Last Post: 08-13-2011, 06:16 AM
  5. How to use this image rss feed with dynamic drive galleries??
    By chas in forum Looking for such a script or service
    Replies: 0
    Last Post: 11-14-2007, 09:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •