示例#1
0
 function get_image($num, $original = false)
 {
     // used variables
     $url = false;
     $output = '';
     // select the proper image function
     if ($this->mode == 'com_content') {
         // load necessary com_content View class
         if (!class_exists('NSP_GK5_com_content_View')) {
             require_once JModuleHelper::getLayoutPath('mod_news_pro_gk5', 'com_content/view');
         }
         // generate the com_content image URL only
         if (!$original) {
             $url = NSP_GK5_com_content_View::image($this->parent->config, $this->parent->content[$num], true, true);
         } else {
             $url = NSP_GK5_com_content_View::originalImage($this->parent->config, $this->parent->content[$num]);
         }
     } else {
         if ($this->mode == 'com_k2') {
             // load necessary k2 View class
             if (!class_exists('NSP_GK5_com_k2_View')) {
                 require_once JModuleHelper::getLayoutPath('mod_news_pro_gk5', 'com_k2/view');
             }
             // generate the K2 image URL only
             if (!$original) {
                 $url = NSP_GK5_com_k2_View::image($this->parent->config, $this->parent->content[$num], true, true);
             } else {
                 $url = NSP_GK5_com_k2_View::originalImage($this->parent->config, $this->parent->content[$num]);
             }
         }
     }
     // check if the URL exists
     if ($url === FALSE) {
         return false;
     } else {
         // if URL isn't blank - return it!
         if ($url != '') {
             return $url;
         } else {
             return false;
         }
     }
 }