mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 04:38:27 +01:00
Thumbnail cache-file name-generation moved to e_parse_class.php as thumbCacheFile()
This commit is contained in:
parent
c4f1f1c04d
commit
cfd6e42260
@ -571,7 +571,7 @@ class e107
|
||||
|
||||
$ret['CACHE_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'cache/';
|
||||
$ret['CACHE_CONTENT_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'content/';
|
||||
$ret['CACHE_IMAGE_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'images/';
|
||||
$ret['CACHE_IMAGE_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'images/'; //TODO Change to MEDIA Directory.
|
||||
$ret['CACHE_DB_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'db/';
|
||||
$ret['CACHE_URL_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'url/';
|
||||
|
||||
|
@ -2487,6 +2487,51 @@ class e_parse extends e_parser
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generated a Thumb Cache File Name from path and options.
|
||||
* @param string $path
|
||||
* @param array $options
|
||||
* @return null|string
|
||||
*/
|
||||
public function thumbCacheFile($path, $options=array())
|
||||
{
|
||||
if(empty($path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$filename = basename($path);
|
||||
$tmp = explode('.',$filename);
|
||||
$ext = end($tmp);
|
||||
$len = strlen($ext) + 1;
|
||||
$start = substr($filename,0,- $len);
|
||||
|
||||
if(!empty($options['aw']))
|
||||
{
|
||||
$options['w'] = $options['aw'];
|
||||
}
|
||||
|
||||
if(!empty($options['ah']))
|
||||
{
|
||||
$options['h'] = $options['ah'];
|
||||
}
|
||||
|
||||
$size = varset($options['w'],0).'x'.varset($options['h'],0);
|
||||
|
||||
$thumbQuality = e107::getPref('thumbnail_quality',65);
|
||||
|
||||
$cache_str = md5(serialize($options).$path. $thumbQuality);
|
||||
|
||||
// TODO Remove these.
|
||||
$pre = 'thumb_';
|
||||
$post = '.cache.bin';
|
||||
// $post = '';
|
||||
|
||||
$fname = $pre.strtolower($start.'_'.$cache_str.'_'.$size.'.'.$ext).$post;
|
||||
|
||||
return $fname;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate an auto-sized Image URL.
|
||||
|
@ -264,10 +264,10 @@ class e_thumbpage
|
||||
// return false;
|
||||
}
|
||||
|
||||
$cache_str = md5(serialize($options). $this->_src_path. $this->_thumbQuality. $options['c']);
|
||||
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
|
||||
|
||||
// $cache_str = md5(serialize($options). $this->_src_path. $this->_thumbQuality);
|
||||
// $fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
|
||||
|
||||
$fname = e107::getParser()->thumbCacheFile($this->_src_path, $options);
|
||||
|
||||
if(($this->_cache === true) && is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname) && ($this->_debug !== true))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user