function resizeimage_wrapper_dbcache in Brilliant Gallery 6
Same name and namespace in other branches
- 5.4 image.php \resizeimage_wrapper_dbcache()
- 5.3 image.php \resizeimage_wrapper_dbcache()
- 6.4 functions.inc \resizeimage_wrapper_dbcache()
- 6.2 image.php \resizeimage_wrapper_dbcache()
- 6.3 image.php \resizeimage_wrapper_dbcache()
- 7.2 OLD_brilliant_gallery_functions.inc \resizeimage_wrapper_dbcache()
- 7 brilliant_gallery_functions.inc \resizeimage_wrapper_dbcache()
File
- ./
image.php, line 85
Code
function resizeimage_wrapper_dbcache($reset = FALSE) {
global $bgcachexpire;
global $user;
#$userId = $user->uid;
$bgcacheid = 'bg_' . md5($_GET['imgp'] . $_GET['imgw'] . $_GET['imgh']);
#echo $bgcacheid;
static $my_data;
#echo '0.... ';
if (!isset($my_data) || $reset) {
if (!$reset && ($cache = cache_get($bgcacheid)) && !empty($cache->data)) {
#$my_data = $cache->data; echo '-1.... ' . $my_data;
$my_data = unserialize($cache->data);
}
else {
// Do your expensive calculations here, and populate $my_data
// with the correct stuff..
$my_data = resizeimage($_GET['imgp'], $_GET['imgw'], $_GET['imgh']);
#echo ' -2.... ' . $bgcachexpire . ' // ' . $my_data;
# For some reason I could not use: mysql_escape_string($my_data)
cache_set($bgcacheid, 'cache', time() + $bgcachexpire, $my_data);
# FOR DRUPAL6 MUST USE:
#cache_set($bgcacheid, $my_data, time() + $bgcachexpire); # For some reason I could not use: mysql_escape_string($my_data)
$my_data = unserialize($my_data);
}
}
return $my_data;
}