Drupal file.inc
Jump to navigation
Jump to search
Not sure if this is necessary yet.
replace the image_get_info function with the following:
function image_get_info($file) {
global $conf;
$temp_image_locker = '/image_mod/';
if(!is_dir($conf["file_directory_temp"].$temp_image_locker)) mkdir($conf["file_directory_temp"].$temp_image_locker);
$temp_img_name = preg_replace("#/tmp/#", "", $file);
if(@move_uploaded_file($file, $conf["file_directory_temp"].$temp_image_locker.$temp_img_name)) $file = $conf["file_directory_temp"].$temp_image_locker.$temp_img_name;
if (!is_file($file) && !is_uploaded_file($file)) {
return FALSE;
}
$details = FALSE;
$data = @getimagesize($file);
$file_size = @filesize($file);
if (isset($data) && is_array($data)) {
$extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
$extension = array_key_exists($data[2], $extensions) ? $extensions[$data[2]] : '';
$details = array('width' => $data[0],
'height' => $data[1],
'extension' => $extension,
'file_size' => $file_size,
'mime_type' => $data['mime']);
}
unlink($file);
return $details;
}