Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding ability to refresh cache by hard refresh

  • Loading branch information...
commit 7ea11a8b6417b5dcaee868ecb51df8d67a724091 1 parent 1a3dcc1
@markhuot markhuot authored
Showing with 23 additions and 10 deletions.
  1. +23 −10 src/PHPThumb.php
View
33 src/PHPThumb.php
@@ -5,13 +5,6 @@
$cache_path = '/Users/markhuot/Sites/PHPThumb/cache/';
$cache_uri = 'http://'.trim($_SERVER['HTTP_HOST'], '/').'/cache/';
-
-
-
-
-
-
-
$params = array('src'=>false, 'w'=>false, 'h'=>false);
$options = array('resizeUp'=>true,'jpegQuality'=>100);
extract(array_merge($params, $options, $_GET));
@@ -21,9 +14,10 @@
require_once 'ThumbLib.inc.php';
-if (file_exists($cache_path.$cache))
+if (file_exists($cache_path.$cache) && @$_SERVER['HTTP_CACHE_CONTROL'] != 'no-cache')
{
- $thumb = PhpThumbFactory::create($cache_path.$cache);
+ header('Location: '.$cache_uri.$cache);
+ exit();
}
else
{
@@ -39,4 +33,23 @@
$thumb->save($cache_path.$cache);
}
-$thumb->show();
+$thumb->show();
+
+
+
+
+
+// function saveit($filename='', $somecontent="")
+// {
+// if (!$handle = fopen($filename, 'a')) {
+// echo "Cannot open file ($filename)";
+// exit;
+// }
+// if (fwrite($handle, date('r: ').$somecontent."\n") === FALSE) {
+// echo "Cannot write to file ($filename)";
+// exit;
+// }
+// fclose($handle);
+// }
+
+// saveit('/Users/markhuot/Desktop/memory.log', 'Memory: '.number_format(memory_get_usage()/1024, 2).' KiB');

0 comments on commit 7ea11a8

Please sign in to comment.
Something went wrong with that request. Please try again.