function resizeimage_wrapper_dbcache in Brilliant Gallery 7
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 image.php \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()
1 call to resizeimage_wrapper_dbcache()
- brilliant_gallery_deliver_image in ./
brilliant_gallery_functions.inc - @todo Please document this function.
File
- ./
brilliant_gallery_functions.inc, line 235
Code
function resizeimage_wrapper_dbcache($reset = FALSE, $imagepath, $bgimgproperties_hash) {
$bgcachexpire = brilliant_gallery_get_days_in_seconds(variable_get('brilliant_gallery_cache_duration', 90));
// Cache expiration time in days.
static $my_data;
$pcache = variable_get('brilliant_gallery_pcache', BRILLIANT_GALLERY_DEFAULT_CACHE_DIR);
//brilliant_gallery_check_or_create_dir($pcache);
$foqen = FILE_DIRECTORY_PATH . '/' . $pcache . '/bg_cached_resized_' . $bgimgproperties_hash;
$lastchanged = @filemtime($foqen);
// Last file modification time, or FALSE on error.
if ($lastchanged === FALSE or REQUEST_TIME - $lastchanged > $bgcachexpire) {
// If the image is expired, we need to actively delete it, for the case that it was removed / hidden by the owner.
@unlink($foqen);
$my_data = resizeimage($_GET['imgp'], $_GET['imgw'], $_GET['imgh'], @$_GET['imgcrop'], $imagepath);
$image = $my_data;
// It happens that the file size is 0 (image not fetched). In such case, don't write it.
if (strlen($image) > 0) {
$fp = fopen($foqen, 'w');
fwrite($fp, $image);
fclose($fp);
}
}
return $my_data;
}