Hey there,
I have a seriuos problem and I don't know any way more how to solve it.
The problem is that my image, used to verificate if a person is near pc, sometimes doesn't chane, even if there are cache limiters.
<?php
session_start();
$font = 'trebuc.ttf'; // Font-type...
//$size = 28; // Font-size...
$size = mt_rand(20,30);
//$spacing = 15; // Initial spacing of first char
$spacing = mt_rand(3,8);
//$height = 40; // Height from the top of the image $height = 40;
$height = mt_rand(20,25);
$blur = 2; // X times the value of 10;
$captcha = $_SESSION['cap'];
$dir = "images";
$im = imagecreatetruecolor(120, 50);
$background = ImageCreateFrompng("$dir/back.png");
$layer1 = ImageCreateFrompng("$dir/layer1.png");
$layer2 = ImageCreateFrompng("$dir/layer2.png");
$rand_x = mt_rand(0, 400);
$rand_y = mt_rand(0, 550);
imagecopy($im, $background, 0, 0, $rand_x, $rand_y, 200, 50);
for($i=0; $i < strlen($captcha); $i++) {
// Randomize a color for each char!
$color = imagecolorallocate($im, mt_rand(230, 255), mt_rand(230, 255),mt_rand(230, 255));
// Add the chars
imagettftext($im, $size, mt_rand(-20, 20), $spacing, $height+15, $color, $font, $captcha{$i});
$spacing += 30; // Adds width between the chars
}
if (function_exists('imagefilter')) {
for ($i = 0; $i < $blur; $i++) imagefilter($im, IMG_FILTER_GAUSSIAN_BLUR, 10);
}
imagecopy($im, $layer1, 0, 0, $rand_x, $rand_y, 200, 50);
imagecopy($im, $layer2, 0, 0, $rand_x, $rand_y, 200, 50);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: no-cache");
header("Cache-Control: post-check=0, pre-check=0", false); // neaiskus xD
header('Cache-Control: no-store, no-cache, must-revalidate');
header("Content-type: image/jpeg");
imagejpeg($im, '', 80);
imagedestroy($im);
?>
Image itself is good, but headers doesn't help me. Any ideas?
Thanks in advance,
Faifas