Php 如何获取zoo Joomla组件的挑逗图片或文章图片
我正在开发Joomla系统插件,在该插件中,我需要获取Zoo Joomla组件文章的摘要图像。我已经解决了一个问题:GetZooArticleSteaserImg函数返回图像路径Php 如何获取zoo Joomla组件的挑逗图片或文章图片,php,joomla,Php,Joomla,我正在开发Joomla系统插件,在该插件中,我需要获取Zoo Joomla组件文章的摘要图像。我已经解决了一个问题:GetZooArticleSteaserImg函数返回图像路径 function getZooArticleTeaserImg($articleId){ require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php'); $zapp = App::getInstance('zoo');
function getZooArticleTeaserImg($articleId){
require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php');
$zapp = App::getInstance('zoo');
$zooitems = $zapp->table->item->all(array('conditions' => 'id = '.$articleId));
$imgpath = '';
foreach($zooitems as $zooitem){
foreach ($zooitem->getElements() as $zooid => $element){
if(in_array($element->getElementType(), array('image', 'media'))){
if($element->config->get('name') == 'Teaser Image'){
$imgpath = $element->get('file');
}
else if(!$imgpath && $element->config->get('name') == 'Image'){
$imgpath = $element->get('file');
}
}
}
}
return $imgpath;
}