This checks that imagecreatetruecolor actually creates an image, rather than returning FALSE. Without this check, subsequent loop might create billions of ERROR-level log messages. Signed-off-by: Byron Marohn <combustible@live.com>tags/v8.0.0alpha1
@@ -658,6 +658,12 @@ class OC_Image { | |||
} | |||
// create gd image | |||
$im = imagecreatetruecolor($meta['width'], $meta['height']); | |||
if ($im == FALSE) { | |||
fclose($fh); | |||
trigger_error('imagecreatefrombmp(): imagecreatetruecolor failed for file "' . $fileName . '" with dimensions ' . $meta['width'] . 'x' . $meta['height'], E_USER_WARNING); | |||
return FALSE; | |||
} | |||
$data = fread($fh, $meta['imagesize']); | |||
$p = 0; | |||
$vide = chr(0); |