dprnr5559 2013-03-06 20:28
浏览 35

为什么我的k2项目对象中缺少图像?

Thanks for helping... I am working on a custom joomla component that pulls k2 items into one of it's views... I was successful getting the k2 items into my component's view by including the k2 content modules helper and then using a little code like so:

<?php

$componentParams = JComponentHelper::getParams('com_k2');
$items = modK2ContentHelper::getItems($componentParams);

foreach ($items as $key=>$item): ?>

    <a class="Item_Title" href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>

<?php endforeach; ?> 

I have most everything I need in the $item object EXCEPT images... For some reason none of the image info is being included in the object?! So I am unable to do what I was hoping and use something like this:

<img src="<?php echo $item->image; ?>" />

Here is a Pastebin.com link to a print_r(); I did on my $item object in the foreach:

http://pastebin.com/tJRB8wbu

I don't even see $item->image available to me :-/

How can I get the k2 item path?

  • 写回答

1条回答 默认 最新

  • douxin2011 2013-05-06 15:10
    关注

    It seems images in K2 is linked with the id of the article.

    You should try something like this :

    $item->image = JPATH_ROOT.'media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg'.
    
    评论

报告相同问题?

悬赏问题

  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线