diff --git a/plugin/Live/getImage.php b/plugin/Live/getImage.php index f79f6b1ac..4e7d25ea0 100644 --- a/plugin/Live/getImage.php +++ b/plugin/Live/getImage.php @@ -1,147 +1,150 @@ _getEncoderURL(); //$encoderURL = $config->getEncoderURL(); //$url = "{$encoderURL}getImage/" . base64_encode($video) . "/{$_REQUEST['format']}"; $url = "{$encoderURL}objects/getImage.php"; $url = addQueryStringParameter($url, 'base64Url', base64_encode($video)); $url = addQueryStringParameter($url, 'format', $_REQUEST['format']); //_error_log("Live:getImage $url"); //header('Content-Type: text/plain');var_dump($url);exit; session_write_close(); _mysql_close(); $content = url_get_contents($url, '', 2); if (empty($content)) { echo file_get_contents($filename); } else { } ob_end_clean(); if (!empty($content)) { if (Live::isDefaultImage($content)) { //header('Content-Type: text/plain');var_dump(__LINE__, $url);exit; //_error_log("Live:getImage It is the default image, try to show the poster "); echo $content; } else { //header('Content-Type: text/plain');var_dump(__LINE__, $url);exit; $socketMessage['cacheName2'] = $name; $socketMessage['cacheName3'] = ObjectYPT::setCache($name, $content); $socketMessage['cacheName4'] = strlen($content); echo $content; $socketObj = sendSocketMessageToAll($socketMessage, 'socketLiveImageUpdateCallback'); } } else { $result = file_get_contents($filename); if(!Live::isDefaultImage($result)){ copy($filename, $cacheFileImageName); } echo $result; //_error_log("Live:getImage Get default image "); } } \ No newline at end of file diff --git a/plugin/LiveLinks/getImage.php b/plugin/LiveLinks/getImage.php index 1c3656156..33cc0875f 100644 --- a/plugin/LiveLinks/getImage.php +++ b/plugin/LiveLinks/getImage.php @@ -1,84 +1,87 @@ getUsers_id(), $_REQUEST['live_servers_id']); //var_dump($livet['users_id'], $_REQUEST['live_servers_id'],$uploadedPoster );exit; if(file_exists($uploadedPoster)){ header('Content-Type: image/jpg'); echo file_get_contents($uploadedPoster); exit; } } $video = $liveLink->getLink(); if (preg_match("/\b(?:(?:https?):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $video)) { $encoderURL = $config->_getEncoderURL(); //$encoderURL = $config->getEncoderURL(); $url = "{$encoderURL}getImage/" . base64_encode($video) . "/{$_REQUEST['format']}"; $name = "liveLinks_getImage_".md5($url); $content = ObjectYPT::getCache($name, $lifetime); if(Live::isDefaultImage($content)){ $content = ''; } if(empty($content)){ session_write_close(); _mysql_close(); $content = url_get_contents($url, "", 2); if(!empty($content)){ ObjectYPT::setCache($name, $content); } } if (!Live::isDefaultImage($content)) { file_put_contents($cacheFileImageName, $content); } } if(!empty($content)){ echo $content; }else{ echo local_get_contents($filename); } \ No newline at end of file