brasco2k
21.05.2008, 12:47
Cитуация такая:
Есть код(генерирует случайные картинки):
<?php
header ("Content-type: image/gif");
header("Cache-Control: no-cache, must-revalidate");
$img = imagecreatetruecolor(800, 600);
$zzz=imagecolorallocate($img, rand(0,255), rand(0,255), rand(0,255));
imagefilledrectangle($img,0,0,800,600,$zzz);
for($i=0;$i<rand(5,40);$i++){
$inkline = imagecolorallocate($img, rand(0,255), rand(0,255), rand(0,255));
imageline($img,rand(20,780),rand(25,580), rand(20,780),rand(25,580),$inkline);
for($n=0;$n<rand(100,250);$n++) {
imagesetpixel($img,rand(0,800),rand(0,600),$inklin e);
}
}
imagegif($img);
imagedestroy($img);
?>
Вроде бы все хорошо, но через некоторое время получаются одинаковые картинки.
Собсно вопрос:
В чем проблема?
p.s Я догадываюсь что проблема в кэшировании сервером. Если да то как отключить?
Есть код(генерирует случайные картинки):
<?php
header ("Content-type: image/gif");
header("Cache-Control: no-cache, must-revalidate");
$img = imagecreatetruecolor(800, 600);
$zzz=imagecolorallocate($img, rand(0,255), rand(0,255), rand(0,255));
imagefilledrectangle($img,0,0,800,600,$zzz);
for($i=0;$i<rand(5,40);$i++){
$inkline = imagecolorallocate($img, rand(0,255), rand(0,255), rand(0,255));
imageline($img,rand(20,780),rand(25,580), rand(20,780),rand(25,580),$inkline);
for($n=0;$n<rand(100,250);$n++) {
imagesetpixel($img,rand(0,800),rand(0,600),$inklin e);
}
}
imagegif($img);
imagedestroy($img);
?>
Вроде бы все хорошо, но через некоторое время получаются одинаковые картинки.
Собсно вопрос:
В чем проблема?
p.s Я догадываюсь что проблема в кэшировании сервером. Если да то как отключить?