Skip to content

Commit

Permalink
Fix feed image (#29237)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ authored Jun 15, 2020
1 parent e18a342 commit f6ad8b0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 23 deletions.
7 changes: 2 additions & 5 deletions administrator/modules/mod_feed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
}

if ($feed != false) :
// Image handling
$iUrl = isset($feed->image) ? $feed->image : null;
$iTitle = isset($feed->imagetitle) ? $feed->imagetitle : null;
?>
<div style="direction: <?php echo $rssrtl ? 'rtl' :'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' :'left'; ?> !important" class="feed<?php echo $moduleclass_sfx; ?>">
<?php
Expand All @@ -76,8 +73,8 @@
<?php endif; ?>

<!-- Feed image -->
<?php if ($params->get('rssimage', 1) && $iUrl) : ?>
<img src="<?php echo $iUrl; ?>" alt="<?php echo @$iTitle; ?>"/>
<?php if ($params->get('rssimage', 1) && $feed->image) : ?>
<img src="<?php echo $feed->image->uri; ?>" alt="<?php echo $feed->image->title; ?>"/>
<?php endif; ?>


Expand Down
4 changes: 2 additions & 2 deletions components/com_newsfeeds/views/newsfeed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
</div>
<?php endif; ?>
<!-- Show Image -->
<?php if (isset($this->rssDoc->image, $this->rssDoc->imagetitle) && $this->params->get('show_feed_image')) : ?>
<?php if ($this->rssDoc->image && $this->params->get('show_feed_image')) : ?>
<div>
<img src="<?php echo $this->rssDoc->image; ?>" alt="<?php echo $this->rssDoc->image->decription; ?>" />
<img src="<?php echo $this->rssDoc->image->uri; ?>" alt="<?php echo $this->rssDoc->image->title; ?>" />
</div>
<?php endif; ?>
<!-- Show items -->
Expand Down
22 changes: 11 additions & 11 deletions libraries/src/Feed/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
/**
* Class to encapsulate a feed for the Joomla Platform.
*
* @property FeedPerson $author Person responsible for feed content.
* @property array $categories Categories to which the feed belongs.
* @property array $contributors People who contributed to the feed content.
* @property string $copyright Information about rights, e.g. copyrights, held in and over the feed.
* @property string $description A phrase or sentence describing the feed.
* @property string $generator A string indicating the program used to generate the feed.
* @property string $image Specifies a GIF, JPEG or PNG image that should be displayed with the feed.
* @property Date $publishedDate The publication date for the feed content.
* @property string $title A human readable title for the feed.
* @property Date $updatedDate The last time the content of the feed changed.
* @property string $uri Universal, permanent identifier for the feed.
* @property FeedPerson $author Person responsible for feed content.
* @property array $categories Categories to which the feed belongs.
* @property array $contributors People who contributed to the feed content.
* @property string $copyright Information about rights, e.g. copyrights, held in and over the feed.
* @property string $description A phrase or sentence describing the feed.
* @property string $generator A string indicating the program used to generate the feed.
* @property FeedLink|null $image FeedLink object containing feed image properties.
* @property Date $publishedDate The publication date for the feed content.
* @property string $title A human readable title for the feed.
* @property Date $updatedDate The last time the content of the feed changed.
* @property string $uri Universal, permanent identifier for the feed.
*
* @since 3.1.4
*/
Expand Down
7 changes: 2 additions & 5 deletions modules/mod_feed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@

if ($feed !== false)
{
// Image handling
$iUrl = isset($feed->image) ? $feed->image : null;
$iTitle = isset($feed->imagetitle) ? $feed->imagetitle : null;
?>
<div style="direction: <?php echo $rssrtl ? 'rtl' :'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' :'left'; ?> !important" class="feed<?php echo $moduleclass_sfx; ?>">
<?php
Expand Down Expand Up @@ -84,9 +81,9 @@
<?php
}
// Feed image
if ($iUrl && $params->get('rssimage', 1)) :
if ($feed->image && $params->get('rssimage', 1)) :
?>
<img src="<?php echo $iUrl; ?>" alt="<?php echo @$iTitle; ?>"/>
<img src="<?php echo $feed->image->uri; ?>" alt="<?php echo $feed->image->title; ?>"/>
<?php endif; ?>


Expand Down

0 comments on commit f6ad8b0

Please sign in to comment.