cvs: php4 /pear/Cache Graphics.php
| From: | Ulf Wendel | Date: | Thu, 20 Dec 2001 15:38:33 +0000 |
| Subject: | cvs: php4 /pear/Cache Graphics.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1632@lists.php.net to get a copy of this message | ||
uw Thu Dec 20 10:38:33 2001 EDT
Modified files:
/php4/pear/Cache Graphics.php
Log:
- names graphics files "id.type", otherwise your webserver will not
recognize the type and send wrong headers
Index: php4/pear/Cache/Graphics.php
diff -u php4/pear/Cache/Graphics.php:1.11 php4/pear/Cache/Graphics.php:1.12
--- php4/pear/Cache/Graphics.php:1.11 Tue Dec 11 10:31:11 2001
+++ php4/pear/Cache/Graphics.php Thu Dec 20 10:38:33 2001
@@ -15,7 +15,7 @@
// | Authors: Ulf Wendel <ulf.wendel@phpdoc.de> |
// +----------------------------------------------------------------------+
//
-// $Id: Graphics.php,v 1.11 2001/12/11 15:31:11 sebastian Exp $
+// $Id: Graphics.php,v 1.12 2001/12/20 15:38:33 uw Exp $
require_once 'Cache.php';
@@ -66,7 +66,7 @@
* the output buffer. Modify it if required!
*
* @author Ulf Wendel <ulf.wendel@phpdoc.de>
-* @version $Id: Graphics.php,v 1.11 2001/12/11 15:31:11 sebastian Exp $
+* @version $Id: Graphics.php,v 1.12 2001/12/20 15:38:33 uw Exp $
* @package Cache
*/
class Cache_Graphics extends Cache {
@@ -157,7 +157,7 @@
* @see cacheImage()
*/
function getImage($id, $format = 'png') {
- $id = $this->generateID(array('id' => $id, 'format' =>
strtolower($format)));
+ $id = $this->generateID($id, $format);
return $this->get($id, $this->cache_group);
} // end func getImage
@@ -176,7 +176,7 @@
* @see cacheImageLink()
*/
function getImageLink($id, $format = 'png') {
- $id = $this->generateID(array('id' => $id, 'format' =>
strtolower($format)));
+ $id = $this->generateID($id, $format);
if (!$this->container->idExists($id, $this->cache_group))
return array();
@@ -210,8 +210,7 @@
if (!$id)
return new Cache_Error('You must provide an ID for and image to be cached!',
__FILE__, __LINE__);
- $id = $this->generateID(array('id' => $id, 'format' =>
strtolower($format)));
-
+ $id = $this->generateID($id, $format);
$types = ImageTypes();
// Check if the requested image type is supported by the GD lib.
@@ -276,8 +275,7 @@
if (!$id)
return new Cache_Error ('You must provide an ID for and image to be cached!',
__FILE__, __LINE__);
- $id = $this->generateID( array('id' => $id, 'format' =>
strtolower($format)) );
-
+ $id = $this->generateID($id, $format);
$types = ImageTypes();
// Check if the requested image type is supported by the GD lib.
@@ -344,6 +342,11 @@
$this->cache_dir = $cache_dir;
$this->container->cache_dir = $cache_dir;
} // end func setCacheDir
+
+
+ function generateID($variable, $format = 'png') {
+ return md5(serialize($variable)) . '.' . $format;
+ } // end func generateID
} // end class Cache_Graphics