Open GoogleCodeExporter opened 9 years ago
I made a little attempt to resolve this my self. It is working BUT! It's not a
very pretty solution. It pretty much writes to a txt file every time the script
resizes an image as well as the timestamp. If it generated more then 10 images
in 1 hour then it will exit the script. But it still allows cached images to
display.
in slir.class.php around line 183 I added this:
// Check the cache based on the request URI
if (SLIR_USE_REQUEST_CACHE && $this->isRequestCached())
$this->serveRequestCachedImage();
else {
$textFile = "num_of_requests.txt";
$fh = fopen($textFile, 'r');
$lastTimestamp = fgets($fh);
$numberofRequests = fgets($fh);
if ($numberofRequests == "") $numberofRequests=0;
if ($lastTimestamp == "") $lastTimestamp = time()."\n";
fclose($fh);
if ($lastTimestamp >= (time()-3600)) {
$fh = fopen($textFile, 'w');
$numberofRequests++;
$stringData = $lastTimestamp.$numberofRequests;
fwrite($fh, $stringData);
fclose($fh);
if ($numberofRequests >= 10) {
die ("To many attempts");
}
}
else {
$numberofRequests = 0;
$lastTimestamp = time();
$fh = fopen($textFile, 'w');
$numberofRequests++;
$stringData = $lastTimestamp."\n".$numberofRequests."bajs";
fwrite($fh, $stringData);
fclose($fh);
}
}
Original comment by pew...@gmail.com
on 11 Jun 2010 at 11:55
Surely the above solution would stop you from having >10 images on a page/site?
Original comment by jimeagle
on 4 Aug 2011 at 10:24
Original issue reported on code.google.com by
pew...@gmail.com
on 11 Jun 2010 at 9:27