I have posted this on the main forum but had no replies so also trying here

http://drupal.org/node/1087594

I need to get kml files to be associated with a Google earth icon instead of the application-octet-stream.png it is showing now. How can I do that please?

CommentFileSizeAuthor
#5 application-google-earth.png3.55 KBPatroclas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Patroclas’s picture

Anyone?

Have I asked a dumb question, not explained enough or nobody knows!?

Anyway - Happy St Patrick's Day!

quicksketch’s picture

Generally speaking, I have to say this is a difficult task. It requires a custom module that provides an entire set of icons and implements hook_filefield_icon_sets(). Doing a quick Google reveals some others have documented this already: http://ymbra.com/en/blog/ramon/changing-icon-filefield-fields.

Unfortunately I don't think the Google Maps KML extension/MIME type is known to FileField. If you know the MIME type, I'd be happy to add it as a feature like I did for #1047480: provide icons for rtf (application/rtf) and pps (application/vnd.openxmlformats-officedocument.presentationml.slideshow) files.

quicksketch’s picture

Status: Active » Fixed

I went ahead and added the following mime checks:

    // Google earth files.
    case 'application/vnd.google-earth.kml+xml':
    case 'application/vnd.google-earth.kmz':
      return 'application-google-earth';

So once you make a custom icon set, you can create an "application-google-earth.png" file for these file types.

Patroclas’s picture

Thank you - just what I needed!

Patroclas’s picture

Using the code in the link in #2 to create a new custom module, this has worked perfectly. A kmz/kml icon is attached if anyone needs it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

drupac_shakur’s picture

Seems the fix linked to in comment #2 of this thread has negative effects on db I/O with > moderate traffic sites as it calls variable_set() in hook_init() and forces the variables cache to update on virtually every request.
This was filling up our MySQL binlog at an alarming rate.