Thank you for the great module.
With Firefox 3 on Linux, my pictures are names image001.JPG (note the uppercase extension).
I am using imagefield-6.x-3.0.tar.gz and image_fupload-6.x-3.0-rc2.tar.gz.
When I browse to a directory to BULK upload images, there are no files listed. Editing of the field in the content type to allow JPG and jpg does not work with the following error, "Only web-standard images (jpg, gif, and png) are supported through the image widget. If needing to upload other types of images, change the widget to use a standard file upload."
If I change imagefield_widget.inc:
the line with
$web_extensions = array('jpg', 'jpeg', 'gif', 'png');
to
$web_extensions = array('jpg', 'jpeg', 'gif', 'png', 'JPG', 'JPEG', 'GIF', 'PNG');
the problem is solved.
This is probably not a "clean" solution, but a hack. It would probably be nice if JPg and jPG worked.
Thank you again for the great module.
Comment | File | Size | Author |
---|---|---|---|
#13 | fupload_image_uppercase.patch | 1.13 KB | haggins |
#6 | ifupload_uppercase.patch | 1.57 KB | Leonth |
Comments
Comment #1
quicksketchImageField and FileField should be smart enough to allow files regardless of their extension. While the field-editing form restricts you to only entering lower-case extensions, when the check is performed from a user uploading a file, it should be case insensitive.
Another good idea just to keep you server clean is to install the Transliterate module, which (I believe) will automatically convert all file names to lower case on the server-side.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedMaybe it's better to hack the code another way:
At line 274 in imagefield_widget.inc, just after the line
$web_extensions = array('jpg', 'jpeg', 'gif', 'png');
Change the line
if (count(array_diff($extensions, $web_extensions))) {
in
if (count(array_udiff($extensions, $web_extensions, 'strcasecmp'))) {
array_udiff uses an external function to test array items equality, while array_diff uses it's own == method, that's case insensitive.
strcasecmp matches two strings case-insensitive. Done! ;-)
Anycase it should be a must in such a module. Bye!
Comment #3
Joel MMCC CreditAttribution: Joel MMCC commented@#2: You should make a proper .patch out of that, Attach it to a Reply, and set the Status of this thread to “needs review.” That will call the PatchBot to come test your patch!
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks for the information, I'm pretty new to Drupal and I still don't know how to manage all that here on the community.
I'll send it asap! Thanks!
Comment #5
quicksketchThis problem looks specific to Image FUpload. I tried the following workflow with ImageField alone and it works as expected:
- Set up an image field that allows "png jpg jpeg gif" extensions.
- Visit node/add/x, upload an image named "example.PNG"
- The image uploads properly and keeps it's upper-case extension.
The extension case should be ignored when performing the validation. When done with ImageField alone the extension can be any case, since there is a "i" after the regular expression comparison to indicate case-insensitive. So rather than making a change to ImageField to work-around a bug in Image FUpload, that module should instead just be fixed to allow case-insensitive extension checking when doing a bulk upload.
Comment #6
Leonth CreditAttribution: Leonth commentedAllowing case-insensitive extension checking would be difficult as it is done by flash / the swf, not Drupal, PHP, or javascript. So if it is indeed possible it must be done on swfupload project (outside drupal).
Here's how to allow upper-case file extensions. It still won't allow files like *.jPg or *.pNG though (only pure upper-cased ones like *.JPG), but I bet not many people have that kind of file names...
Comment #7
grandcat CreditAttribution: grandcat commentedI think, that's right. Thank you for the patch, I'll check this one.
Comment #8
my-family CreditAttribution: my-family commentedThank you, the patch works perfectly for me (ImageField 6.x-3.1; Image FUpload 6.x-3.0-rc2).
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedAnother option if you don't fancy hacking php code etc till this is properly fixed is to use a bash script (if you're using Linux/Unix/OS X of course, or cygwin) to convert all files to lowercase before attempting to upload files.
Comment #10
grandcat CreditAttribution: grandcat commentedCommitted to HEAD. Thx.
Comment #12
rfayMarked #594654: Allow for upper-case file extensions (JPG, GIF, PNG, JPEG) as a duplicate of this one.
Comment #13
haggins CreditAttribution: haggins commentedI'm using Image FUpload 6.x-3.x-dev (2010-Jul-11) and it's still not possible to upload/select files with uppercase extension for image nodes.
Here's the patch:
Comment #14
haggins CreditAttribution: haggins commented