- } else {
- // check headers
- $imageinfo = getimagesize($absolute_path);
- if ($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpeg'&& $imageinfo['mime'] != 'image/jpg'&& $imageinfo['mime'] != 'image/png') {
- Tools::logm('processed image with bad header. Skipping ' . $fullpath);
- } else {
- // regenerate image
- $im = imagecreatefromstring($rawdata);
- if ($im) {
- switch ($imageinfo['mime']) {
- case 'image/gif':
- imagegif($im, $fullpath);
- break;
- case 'image/jpeg':
- case 'image/jpg':
- imagejpeg($im, $fullpath, REGENERATE_PICTURES_QUALITY);
- break;
- case 'image/png':
- imagepng($im, $fullpath, ceil(REGENERATE_PICTURES_QUALITY / 100 * 9));
- break;
- }
- imagedestroy($im);
- } else {
- Tools::logm('error while regenerating image ' . $fullpath);
- }
- }
+ return false;
+ }
+
+ // check headers
+ $imageinfo = getimagesize($absolute_path);
+ if ($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpeg'&& $imageinfo['mime'] != 'image/jpg'&& $imageinfo['mime'] != 'image/png') {
+ Tools::logm('processed image with bad header. Skipping ' . $fullpath);
+ return false;