2021-02-23, 06:51 PM
Hi
I have simple script
and this return file header
it is ok, this is what i need = when I use link test/status.php?id=1
but when I use rewrite = I need to use link test/1.png < link work but change file header information
this is my .htaccess
rewrite change header information to
what i need to do to not change header, i dont need cache for this image
I have simple script
<?php
ob_start();
define("VISITOR", "fonts/visitor.ttf");
$image_background = imagecreatefrompng("images/background/bg.png");
$white = imagecolorallocate($image_background,255,255,255);
$id = $_GET['id'];
if($id == "1")
{
imagettftext($image_background,7.5,0,35,10,$white,VISITOR, "Test 1");
}
elseif($id == "2")
{
imagettftext($image_background,7.5,0,35,10,$white,VISITOR, "Test 2");
}
else
{
imagettftext($image_background,7.5,0,35,10,$white,VISITOR, "Test");
}
header("Content-Type: image/png");
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
imagepng($image_background);
imagedestroy($image_background);
ob_end_flush();
?>
and this return file header
Array
(
[0] => HTTP/1.1 200 OK
[1] => Server: nginx
[2] => Date: Tue, 23 Feb 2021 18:38:27 GMT
[3] => Content-Type: image/png
[4] => Connection: close
[5] => Expires: Sat, 1 Jan 2000 01:00:00 GMT
[6] => Cache-Control: no-cache, must-revalidate
[7] => Pragma: no-cache
[8] => Last-Modified: Tue, 23 Feb 2021 18:38:27 GMT
[9] => X-Nginx-Cache-Status: BYPASS
[10] => X-Server-Powered-By: PS
)
Array
(
[0] => HTTP/1.1 200 OK
[Server] => nginx
[Date] => Tue, 23 Feb 2021 18:38:27 GMT
[Content-Type] => image/png
[Connection] => close
[Expires] => Sat, 1 Jan 2000 01:00:00 GMT
[Cache-Control] => no-cache, must-revalidate
[Pragma] => no-cache
[Last-Modified] => Tue, 23 Feb 2021 18:38:27 GMT
[X-Nginx-Cache-Status] => BYPASS
[X-Server-Powered-By] => PS
)
it is ok, this is what i need = when I use link test/status.php?id=1
but when I use rewrite = I need to use link test/1.png < link work but change file header information
this is my .htaccess
RewriteEngine on
RewriteRule ([^-]*).png$ status.php?id=$1
rewrite change header information to
Array
(
[0] => HTTP/1.1 200 OK
[1] => Server: nginx
[2] => Date: Tue, 23 Feb 2021 18:38:27 GMT
[3] => Content-Type: image/png
[4] => Connection: close
[5] => Last-Modified: Tue, 23 Feb 2021 18:37:45 GMT
[6] => Expires: Sat, 24 Apr 2021 18:38:27 GMT
[7] => Cache-Control: max-age=5184000
[8] => Pragma: public
)
Array
(
[0] => HTTP/1.1 200 OK
[Server] => nginx
[Date] => Tue, 23 Feb 2021 18:38:27 GMT
[Content-Type] => image/png
[Connection] => close
[Last-Modified] => Tue, 23 Feb 2021 18:37:45 GMT
[Expires] => Sat, 24 Apr 2021 18:38:27 GMT
[Cache-Control] => max-age=5184000
[Pragma] => public
)
what i need to do to not change header, i dont need cache for this image