Commit a4cf5280 authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Check mimetype when bits per pixel not returned by gd (bug #784978)"

parents a2b44542 a7d5e2fd
......@@ -527,8 +527,14 @@ function get_dataroot_image_path($path, $id, $size=null) {
// gd can eat a lot of memory shrinking large images, so use a placeholder image
// here if necessary
if (isset($imageinfo[0]) && isset($imageinfo[1]) && isset($imageinfo['bits'])) {
$approxmem = $imageinfo[0] * $imageinfo[1] * ($imageinfo['bits'] / 8)
if (isset($imageinfo['bits'])) {
$bits = $imageinfo['bits'];
}
else if ($imageinfo['mime'] == 'image/gif') {
$bits = 8;
}
if (isset($imageinfo[0]) && isset($imageinfo[1]) && !empty($bits)) {
$approxmem = $imageinfo[0] * $imageinfo[1] * ($bits / 8)
* (isset($imageinfo['channels']) ? $imageinfo['channels'] : 3);
}
if (empty($approxmem) || $approxmem > get_config('maximageresizememory')) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment