Keyword

Show images in Item view for user latest items

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 8 months ago - 3 years 8 months ago #178251 by Goble002
Hi,

is it possible to Show images in Item view for user latest items ?

I have tried below but only image alt info is loading :-(
<?php
/*
A note regarding 'Latest items from author'...
The $item object in the foreach loop carries most item data, so if you wish to show the image of these items just echo $item->image.
Do a var_dump($item) to see what's included with $item.
*/
?>
<?php if($this->item->params->get('itemAuthorLatest') && empty($this->item->created_by_alias) && isset($this->authorLatestItems)): ?>
<!-- Latest items from author -->

<h3><?php echo JText::_('K2_LATEST_FROM'); ?> <?php echo $this->item->author->name; ?></h3>
<div class="itemRelatedlist">
<?php foreach($this->authorLatestItems as $key=>$item): ?>
<div class="itemrelatedview">

<img style="width:<?php echo $item->imageWidth; ?>px;height:auto;" class="itemRelImg" src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>" /></a>

<?php if($this->item->params->get('itemRelatedTitle', 1)): ?>
<?php echo $item->title; ?>
<?php endif; ?>

</div>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
Last edit: 3 years 8 months ago by JoomlaWorks.

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago - 3 years 8 months ago #178281 by JoomlaWorks
Replied by JoomlaWorks on topic Show images in Item view for user latest items
Replace "<?php echo $item->image; ?>" with "<?php echo $item->imageM; ?>" which is the exact image size you'd like to fetch ("M" for "medium" size used as an example, the other variants are: XS, S, M, L, XL).

Let me know.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 3 years 8 months ago by JoomlaWorks.

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 8 months ago #178289 by Goble002
Replied by Goble002 on topic Show images in Item view for user latest items
Thank you so much @Fotis

However no luck. HTML Output :
<div class="itemrelatedview">
                
                <img style="width:<br />
<b>Notice</b>:  Undefined property: stdClass::$imageWidth in <b>/internalpath/public_html/photos2/templates/my-template/html/com_k2/default/item.php</b> on line <b>321</b><br />
px;height:auto;" class="itemRelImg" src="/<br />
<b>Notice</b>:  Undefined property: stdClass::$imageM in <b>/internalpath/public_html/photos2/templates/my-template/html/com_k2/default/item.php</b> on line <b>321</b><br />
" alt="Copy of Copy of Test item 4">
                
                                Copy of Copy of Test item 4                                
            </div>

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #178292 by JoomlaWorks
Replied by JoomlaWorks on topic Show images in Item view for user latest items
Try "<?php echo $item->imageMedium; ?>" instead.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum