Closed (fixed)
Project:
IMCE
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Oct 2010 at 20:38 UTC
Updated:
22 Nov 2010 at 04:40 UTC
I've configured IMCE with "Maximum image resolution" = 800x600. When trying to upload a .swf file, I get an error that the image's dimensions are too large. I don't think that .swf files should be considered images.
Here's how I modified imce/inc/page.inc to ensure that only images of supported types (.jpg, .jpeg, .gif and .png) are passed to file_validate_image_resolution:
function imce_validate_all(&$file, $imce) {
//fix FILE_EXISTS_ERROR bug. core bug #54223.
if (!$file->destination && variable_get('imce_settings_replace', FILE_EXISTS_RENAME) == FILE_EXISTS_ERROR) {
return array(t('File browser is set to reject the upload of existing files.'));
}
//validate image resolution only if filesize validation passes.
//because user might have uploaded a very big image
//and scaling it may exploit system memory.
$errors = imce_validate_filesize($file, $imce['filesize']);
+ if (imce_image_info($file->filepath)) {//image must of a supported type
if (empty($errors)) {//image resolution validation
$errors = array_merge($errors, file_validate_image_resolution($file, $imce['dimensions']));
}
+ }
if ($imce['quota']) {//directory quota validation
...
Apologies but I don't quite know how to make a patch file.
Comments
Comment #1
apetryk commentedComment #2
ufku commentedCommitted. thanks.
Comment #3
ufku commented