Panowie mam do przerobienia skrypt poniżej:
if($dane['waznosc']>time())
{
$tab = explode('.', $_GET['file']); switch($roz)
{
case 'png':
header('Content-Type: image/png'); break;
case 'gif':
header('Content-Type: image/gif'); break;
case 'jpg':
header('Content-Type: image/jpeg'); break;
case 'jpeg':
header('Content-Type: image/jpeg'); break;
}
}
Chodzi o zmianę file_get_contents na curl'a.
Po kilku lekturach zmieniłem na coś takiego jednak nie wiem czy dobrze to zrobiłem...
Mógłbym ktoś "rzucić okiem" ?
if($dane['waznosc']>time())
{
$ch = curl_init(SITE_URL.'asduyci8723'.$_GET['file']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$obrazek = curl_exec($ch);
$tab = explode('.', $_GET['file']); curl_close($ch);
switch($roz)
{
case 'png':
header('Content-Type: image/png'); break;
case 'gif':
header('Content-Type: image/gif'); break;
case 'jpg':
header('Content-Type: image/jpeg'); break;
case 'jpeg':
header('Content-Type: image/jpeg'); break;
}
}