- Issue created by @rimu
Recently I updated to D7.100 and image uploads stopped working. Image file paths being sent to image_imagemagick_get_info() no longer include the extension in the file name so validation of the file type failed. I altered image_imagemagick_get_info() to fall back to the mime type in this case. The new code for that function is
function image_imagemagick_get_info(stdClass $image) {
$details = FALSE;
$data = _imagemagick_getimagesize(drupal_realpath($image->source));
if (isset($data) && is_array($data)) {
$extension = pathinfo($image->source, PATHINFO_EXTENSION);
if($extension == '' && !empty($data['mime'])) {
$parts = explode('/', $data['mime']);
if (count($parts) === 2) {
$extension = end($parts);
}
}
$details = array(
'width' => $data[0],
'height' => $data[1],
'extension' => $extension,
'mime_type' => $data['mime'],
);
}
return $details;
}
Active
1.0
Code