コード例 #1
0
ファイル: cover.php プロジェクト: TFToto/playjoom-builds
 /**
  * Method for to create a temporary cover file for PlayJoom viewers
  *
  * @param array  $coverdata          Datas for creating the cover
  * @param string $path               The temporary path to the cover file
  * @param string $filename           Name of the cover file
  * @param number $standart_img_width Width configuration for covers
  *
  * @return void
  */
 private function createCoverfile($coverdata, $path, $filename)
 {
     $dispatcher = JDispatcher::getInstance();
     //Get file extension
     if (isset($coverdata->mime)) {
         $FileExtension = PlayJoomHelperCover::getFileExtension($coverdata->mime);
     }
     if ($coverdata) {
         $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Valid cover data found.', 'priority' => JLog::INFO, 'section' => 'site')));
         //write the cover file
         if ($filename && $path) {
             if ($tempimagefile = @fopen($path . DIRECTORY_SEPARATOR . $filename . '.' . $FileExtension, 'wb')) {
                 if (extension_loaded('gd')) {
                     $tmp_img = PlayJoomHelperCover::ResampleImage($coverdata);
                     //Output the cover thumb
                     fwrite($tempimagefile, $tmp_img);
                     fclose($tempimagefile);
                 } else {
                     fwrite($tempimagefile, $coverdata->data);
                     fclose($tempimagefile);
                 }
             }
         }
     }
 }