function hotlinkimage($cat_id, $type, $imgid, $key)
 {
     global $mosConfig_live_site, $my;
     $gallery = new gallery($cat_id, false);
     if (!$key) {
         $key = $gallery->getImageKey($imgid);
     } else {
         $imgid = $gallery->_images[$key]->_id;
     }
     $image = new image($imgid);
     $image->getInfo();
     if ($this->_CONFIG['hotlinkProtection']) {
         $params = "uid=" . $my->id . "&catid=" . $cat_id . "&key=" . $key . "&type=" . $type;
         $params = $this->encrypt($params);
         return $mosConfig_live_site . "/components/com_zoom/www/image.php?q=" . $params;
     } else {
         if ($type == '0') {
             return $mosConfig_live_site . "/" . $this->_CONFIG['imagepath'] . $gallery->_dir . "/" . $image->_viewsize;
         } elseif ($type == '1') {
             return $mosConfig_live_site . "/" . $this->_CONFIG['imagepath'] . $gallery->_dir . "/" . $image->_filename;
         } else {
             return $image->_thumbnail;
         }
     }
 }