zendframework / zend-feed

Feed component from Zend Framework
BSD 3-Clause "New" or "Revised" License
166 stars 42 forks source link

geImage() on entries/Items throws error #47

Closed rajjanorkar closed 7 years ago

rajjanorkar commented 7 years ago

I am getting error when i am trying to get the images of every feed entry using getImage() function.

  Reader::setHttpClient(new GuzzleClient());
    $feed = Reader::import('http://sportbild.bild.de/rss/vw-startseite/vw-startseite-45028186,sort=1,view=rss2.sport.xml');
    $data = [
        'title'        => $feed->getTitle(),
        'link'         => $feed->getLink(),
        'dateModified' => $feed->getDateModified(),
        'description'  => $feed->getDescription(),
        'language'     => $feed->getLanguage(),
        'entries'      => [],
    ];

    foreach ($feed as $entry) {
        $edata = [
            'title'        => $entry->getTitle(),
            'description'  => $entry->getDescription(),
            'dateModified' => $entry->getDateModified(),
            'authors'      => $entry->getAuthors(),
            'link'         => $entry->getLink(),
            'content'      => $entry->getContent(),
            'images'      => $entry->getImage(),
        ];
        $data['entries'][] = $edata;
    }`

Below is the error i am getting

Method: getImage does not exist and could not be located on a registered Extension in AbstractEntry.php (line 206) at AbstractEntry->__call('getImage', array())

froschdesign commented 7 years ago

@rajjanorkar

I am getting error when i am trying to get the images of every feed entry using getImage() function.

This is correct, because an entry has no image. Only the feed or channel element has got an image / logo.

Reference: