Offshoot from http://drupal.org/node/62741.

Attached patch adds the possibility for mime type based file icons if the theme is providing some. These have to be stored in a subfolder /mime below your current theme directory, i.e. /themes/yourtheme/mime/jpeg.png or /themes/yourtheme/mime/pdf.png.

  • If no mime type icon is found, an arrow is displayed.
  • $file->url is defined in front of theming now.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

@ymcp: Looked after your remark (http://drupal.org/node/62741#comment-117263) - if you provide a description for your uploaded file, this description will be displayed below the file name, i.e.

[icon] [file name OR title through inline-tag] ([size])
[description]

If you do not supply a description, the second line will not be displayed.

ymcp’s picture

I didn't give a description when I uploaded the file. The inline module just seems to have used the file name.

Anyway, on a more interesting note, I have located some GPL file type icons. It might be nice to use them with this module. Since the "inline" module is also GPL, there shouldn't be any problem using them. It would be nice to have a note in the README about where to get these icons, or (even better) a default "/mime/" folder with some common icons included as part of this package.

Anyway, the icons are from the KDE project. You can see them all in the online svn repository, or download the entire (20+ Mb) kdebase tar-ball, and extract all the files called "cr*.png".

There are several sizes. I think "cr32-app-acroread.png" makes a nice pdf logo, "cr32-app-abiword.png" would work for ".doc" files, while "cr32-app-edu_mathematics.png" might do for spreadsheets.

sun’s picture

I can't reproduce the bug you mentioned, even not with the attached patch of this issue.

[inline:filename.pdf]

will display:

» filename.pdf (102.58 KB)

And

[inline:filename.pdf=Whatever]

will display:

» Whatever (102.58 KB)

If you do not alter the default description of your attachment in the upload section, then the following will be output:

» Whatever (102.58 KB)
         filename.pdf

If you define a custom description then it will be

» Whatever (102.58 KB)
         My custom description in a HTML <dd>-tag, which may be styled in any way by your theme.

Using Drupal 4.7.1-stable with upload.module.

sun’s picture

FileSize
1.42 KB

Attached is an update for INSTALL.txt, describing the usage of mime type icons with inline.module.

@ymcp: I would like to postpone the discussion of including default GPL'd mime type icons with inline.module. There have been a lot discussions on Drupal.org regarding this topic and I do not want to delay this commit just because of this discussion. There also more questions to answer, f.e. one would like to have 16x16 icons, someone else maybe bigger icons with 32x32. Please open a separate issue for this topic if you feel that this is needed.

sun’s picture

Status: Needs review » Fixed
FileSize
1.22 KB

Thanks for reporting, reviewing, and testing! Committed to 2.x.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

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