Item::getMainPic PHP Method

getMainPic() public method

得到商品主图
public getMainPic ( ) : type
return type
    public function getMainPic()
    {
        $img = $this->getMainPicPath();
        if (file_exists(dirname(F::basePath()) . $img)) {
            $img_thumb = F::baseUrl() . ImageHelper::thumb(310, 310, $img, array('method' => 'resize'));
            $img_thumb_now = CHtml::image($img_thumb, $this->title);
            return CHtml::link($img_thumb_now, array('/item/view', 'id' => $this->item_id), array('title' => $this->title));
        } else {
            return CHtml::link(CHtml::image($this->getHolderJs('310', '310')), $this->getUrl(), array('title' => $this->title));
        }
    }