Windows-bitmaps will not be resized by imagefield. There's no setting like "allowed image types". You can e. g. destroy any layout by uploading an oversized BMP-Image. Affected versions (tested): 5.x-1.1 to 5.x-2.x-dev.
Windows-bitmaps will not be resized by imagefield. There's no setting like "allowed image types". You can e. g. destroy any layout by uploading an oversized BMP-Image. Affected versions (tested): 5.x-1.1 to 5.x-2.x-dev.
Comments
Comment #1
baja_tz commentedSame problem. Imagefield maximum resolution 400x400, also have imagecache 2 presets: 300x300, 100x100. When I try to upload .bmp file: 1200x1596 size: 5.7MB, after while, image is uploaded, no resizing at all. Thanks for help.
imagefield 5.x-1.1
CCK 5.x-1.6-1
Sorry, works in 5.x-2.x-dev, just doesn't display warning message if i in both fields (have 2 single value imagefields) put bmp's.
Comment #2
jsethi commentedIm having the same problem. Wish I knew a way to restrict the file types.
The BMP images are not resized. I am using ImageCache for resizing.
Comment #3
jsethi commentedIm having the same issue.
Need a way to restrict file types.
Comment #4
baja_tz commentedDon't want to be boring, but it's possible to change extension from bmp to jpg, then image pass through without resizing.
imagefield 5.x-2.x
Comment #5
baja_tz commentedPossible solution:
So far works for me.
Comment #6
JStarcher commentedwhat's the deal with the $field['widget']['file_extensions']? Where is that from?
Also, how are you passing passing this? I used hook_nodeapi() on the validate op....
Comment #7
lias commentedI've just installed release candidate 2 and had the same issue with a bmp file that was way too large (didn't retain the size I had input for the imagefield) for the layout. I was wondering too if there was someplace to limit the file types accepted, like filefield does? I only want users to be able to upload png, gif and jpg.
I'm using:
Content 5.x-1.6-1
Private downloads
Image Field 5.x-2.0-rc2
Drupal 5.5
I would also like to know where the above code was inserted if in fact fixes this problem.
Thanks.
Comment #8
baja_tz commentedIt's on line 776. Original:
if (strpos($file['filemime'], 'image/') !== 0) {Try to add:
if (strpos($file['filemime'], 'image/') !== 0 || strpos($file['filemime'], 'image/bmp') === 0 ) {This solution is only temporary, because it's unreliable. There is lot stuff written about it. You might want to read this:
http://www.jellyandcustard.com/2006/01/19/php-mime-types-and-fileinfo/
Comment #9
m3avrck commentedsubscribe, having the same issue
Comment #10
drubage commentedAlso subscribing. Where does the resize occur in the code? I have seen bmp extensions written for the php image resizing tool. Maybe we can add one of them to the code? I need to see where it happens though to be sure.
-Drew
Comment #11
leokyle commentedSubscribing, same issue.
Comment #12
JStarcher commentedI used that code in my custom module inside hook_nodeapi()
Works great. Hope this helps!
Comment #13
lias commentedSorry but I don't understand where this code should be used? Is it inserted into imagefield.module or template.php ?
Comment #14
leokyle commentedIts useful but not a real solution .. i think its gonna be better adding a list of allowed mime types instead of blocking the not allowed ones. i have seen it somewhere before for imagefield...
Comment #15
drubage commentedWhy isn't the goal here to add the functionality to resize bmp files? Is it completely not possible with PHP? I know it's not part of gd but I think there's a workaround somewhere out there. I've seen some functions like ImageBMP (http://scripts.66c.com/imagebmp-and-imagecreatefrombmp-functions-7216.html) which can resize bmp files and write them to the server.
-Drew
Comment #16
dopry commentedWhy don't you just remove .bmp from the allowed extensions. It should be able to change it on the field settings form.
Comment #17
lias commentedI don't have bmp as an allowed extension and yet a user uploaded one.
Comment #18
Firetracker commentedSame issue - anyone got a solution yet?
Comment #19
vitich commentedI need it too.
Filetype restriction or something else that will fix it.
P.S. My customer asked me today "what`s wrong with my thumbnails?" Well... :)
--
Victor from Ecovillage Dolyna Djerel
Comment #20
gaele commentedThree things:
- the standard GD-library doesn't process BMP files. Imagecache won't resize them, and they will show up at their original size.
- since 5.x-2.0 Imagefield has a setting "Permitted upload file extensions". So you can block BMP files there.
- if you want to accept (and resize) BMP files try the ImageMagick library: http://drupal.org/node/131994
Comment #21
ethanw commentedI also had this issue. While small, it renders the module unusable for production sites without modification. The line numbers from #8 weren't quite rigut for me, instead I replaced the code (no php tags in the code, just for syntax highlighting):
with