function brilliant_gallery_image_properties_set in Brilliant Gallery 6.4
Same name and namespace in other branches
- 7.2 OLD_brilliant_gallery_functions.inc \brilliant_gallery_image_properties_set()
- 7 brilliant_gallery_functions.inc \brilliant_gallery_image_properties_set()
2 calls to brilliant_gallery_image_properties_set()
File
- ./
functions.inc, line 101
Code
function brilliant_gallery_image_properties_set($bgimgproperties_array) {
// Binds image property array with its hash that is present in the cached file name and in the URL.
$bgimgproperties_hash = md5(serialize($bgimgproperties_array));
// Let's keep the array in cache. Check if it is in cache. If not, write it.
//echo 0;
$countie = db_result(db_query("SELECT COUNT(*) FROM {brilliant_gallery_image_arrays} WHERE hash = '" . $bgimgproperties_hash . "'"));
if ($countie == 0) {
// Run an insert
//echo 1;
$fields = new stdClass();
$fields->hash = $bgimgproperties_hash;
$fields->array = serialize($bgimgproperties_array);
$fields->datetime = date('Y-m-d H:i:s', time());
//$fields = array("hash" => $bgimgproperties_hash, "array" => $bgimgproperties_array, "datetime" => date( 'Y-m-d H:i:s', time() ));
drupal_write_record("brilliant_gallery_image_arrays", $fields);
}
else {
// Run an update
//echo 2;
$change = array(
'datetime' => date('Y-m-d H:i:s', time()),
'hash' => $bgimgproperties_hash,
);
drupal_write_record('brilliant_gallery_image_arrays', $change, 'hash');
}
//echo 3;
return $bgimgproperties_hash;
}