示例#1
0
 static function attachThumbnail($ticketid, $fileid, $for_user = false)
 {
     $ticket = new SupportTicket();
     if ($ticket->load($ticketid, $for_user)) {
         $attach = $ticket->getAttach($fileid);
         $image = in_array(strtolower(pathinfo($attach->filename, PATHINFO_EXTENSION)), array('jpg', 'jpeg', 'png', 'gif'));
         if (!$image) {
             exit;
         }
         $image_file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "support" . DS . $attach->diskfile;
         $thumb_file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "thumbnail" . DS . $attach->diskfile . ".thumb";
         $thumb_path = pathinfo($thumb_file, PATHINFO_DIRNAME);
         if (!file_exists($thumb_path)) {
             mkdir($thumb_path, 0755, true);
         }
         require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'files.php';
         FSS_File_Helper::Thumbnail($image_file, $thumb_file);
     }
     exit;
 }