Last modified: 2011-03-13 18:05:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T6188, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 4188 - *.ico files could be uploaded (after patching) but are not rendered inline and not thumbnailed (solution needed)
*.ico files could be uploaded (after patching) but are not rendered inline an...
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.5.x
All All
: Lowest normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-05 23:49 UTC by T. Gries
Modified: 2011-03-13 18:05 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description T. Gries 2005-12-05 23:49:30 UTC
I wanted to create a small image gallery aka 'favicons'.

I found two problems, the first one while uploading

debug.log:
WebRequest::getFileName() 'myfavicon.ico' normalized to 'myfavicon.ico'
Block::load: '84.191.72.110', '1', 1
MimeMagic::MimeMagic: loading mime types from includes/mime.types
MimeMagic::MimeMagic: loading mime info from includes/mime.info
MimeMagic::detectMimeType: no magic mime detector found!
MimeMagic::detectMimeType: image mime type of /tmp/php7eycaa: image/vnd.wap.wbmp
MimeMagic::guessMimeType: final mime type of /tmp/php7eycaa: image/vnd.wap.wbmp
SpecialUpload::verifyExtension: mime type image/vnd.wap.wbmp mismatches file
extension ico, rejecting file

Solution:  add in the file /includes/mime.types the line
  image/vnd.wap.wbmp ico

Remark: this type was shown in the debug log for several files of different
origin when uploading with Netscape 7.1

and add in /includes/DefaultSettings.php the file extension to the existing array
  $wgFileExtensions = array(......,  'ico' )

This allows to upload an *.ico file.

However, the image page is not showing the thumbnail, perhaps because the
thumbnail routines cannot render this. But also [[image:myfavicon.ico]] does not
work, i.e. does not render the image (needs to be fixed). 

Both problems need review of experts of the /include/Image.php module.
Comment 1 Brion Vibber 2005-12-05 23:53:47 UTC
Most browsers don't support Windows icon files.
Comment 2 Daniel Kinzler 2005-12-06 00:04:14 UTC
First of all, with "image/vnd.wap.wbmp ico" you told mediawiki that windows bmp
files are icon files - that's simply wrong. Get your mime detection to work -
under linux, you can set $wgMimeDetectorCommand= "file -bi", that should do it.
Alternatively, get a version of PHP that has either the fileinfo or the
mime_magic extension compiled in. ico files should be tectected as image/x-icon.

Second, ico-files will not be handeled as images by mediawiki, because many
browsers do not support it, and it can't really be scaled. It could be rendered
server-side using imagemagick in theory, but this is suppressed, because ico
files may contain multiple images (for animations, or different ones for
enabled/disabled, etc), and the software can't know which one to use. You can
hack that locally, if you want, by uncommenting the following line in the
canRender function in Image.php: 

 #|| $mime === 'image/x-icon'   #file may be split into multiple parts

HTH
Comment 3 Brion Vibber 2005-12-06 00:26:37 UTC
Note that wbmp isn't Windows Bitmap, it's some other format for use with WAP.
Comment 4 T. Gries 2005-12-06 00:39:38 UTC
The tip with  $wgMimeDetectorCommand= "file -bi" was perfect (I overlooked that
for weeks) !

But now a request for small code cosmetics in CVS HEAD:

Add in DefaultSettings.php in that line 266 a semicolon after -bi"

265 $wgMimeDetectorCommand= NULL; # use internal mime_content_type function,
available since php 4.3.0
266 #$wgMimeDetectorCommand= "file -bi" #use external mime detector (linux)

-->
266 #$wgMimeDetectorCommand= "file -bi"; #use external mime detector (linux)
Comment 5 Rowan Collins [IMSoP] 2005-12-06 00:52:30 UTC
(In reply to comment #4)
> Add in DefaultSettings.php in that line 266 a semicolon after -bi"

Done.
Comment 6 T. Gries 2005-12-06 00:57:13 UTC
Hope, that it's okay when I now wontfix this bugzilla.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links