$object) { if($object[$sort_by]) $sort_objects[$key]=$object[$sort_by]; } if(!is_array($sort_objects)) { s_log_error('$sort_objects is not an array'); return; } if($reverse) arsort($sort_objects, $flags); else asort($sort_objects, $flags); h_cache_put_object($param_string, $sort_objects, 'object', __GAL_THUMBS_DIR); } return $sort_objects; } #--------------------------------------------------------------------- function gal_get_extra_object_from_file($file, $object, $detail=0) { if($detail) $img_info = @getImageSize($file, &$img_detail); else $img_info = @getImageSize($file); if(is_array($img_info)) { $object['IMG_W']=$img_info[0]; $object['IMG_H']=$img_info[1]; $object['IMG_TYPE']=$img_info[2]; $object['IMG_SIZE']=$img_info[3]; if($detail>=2) { if(!empty($img_info['bits'])) $object['IMG_BITS']=$img_info['bits']; if(!empty($img_info['channels'])) $object['IMG_CHANNELS']=$img_info['channels']; if(is_array($img_detail)) { foreach($img_detail as $key => $value) { $img_key="IMG_$key"; $object[$img_key]=$value; } } } if(empty($img_info['mime'])) $img_info['mime']=image_type_to_mime_type($object['IMG_TYPE']); if(!empty($img_info['mime'])) { s_log("Redefining Image MIME type: ".$object['MIME'].'--->'.$img_info['mime'],0,0,2); $object['MIME']=$img_info['mime']; } } else s_log_error("$file: No Image Info available"); $object['IMG_TITLE']=gal_get_image_title($object); return $object; } function gal_get_image_title($object) { if(!empty($object['WO_EXT'])) { $text_file=$object['DIR'].'/'.$object['WO_EXT'].'.txt'; s_log("text_file: $text_file",0,0,2); if(file_exists($text_file)) { $file=fopen($text_file,'r'); if($file) { $text=fread($file,1024); fclose($file); #s_log("Using text file contents: $text",0,0,2); } } if(empty($text)) $text=str_replace("_", " ", ($object['WO_EXT'])); } if(empty($text)) $text=str_replace("_", " ", ($object['FILE'])); s_log("text: $text",0,0,3); //return nl2br(htmlentities($text)); // File title should be returned as is return $text; } #--------------------------------------------------------------------- } //__GAL_OBJECTS__ ?>