Icons for different file types

xpisik - March 6, 2007 - 12:17
Project:Fileshare
Version:5.x-1.0
Component:Module
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

You web site fileshare demo has an ability to display different file types icons:
http://jamieruderman.com/?q=node/9
How can I do that?
Thanks in advance.

#1

JamieR - March 6, 2007 - 17:12

Checkout this release for the latest fileshare 5.x-1.x-dev.

Jamie.

#2

JamieR - March 11, 2007 - 16:51
Status:active» fixed

#3

malcomm - March 20, 2007 - 19:08
Status:fixed» patch (code needs review)

Created a simple patch to add icon support for .PPT & .VSD.

AttachmentSize
fieshare-icon-ppt-vsd.patch1.64 KB

#4

malcomm - March 20, 2007 - 19:09

VSD icon

AttachmentSize
file-vsd.gif637 bytes

#5

malcomm - March 20, 2007 - 19:09

PPT icon

AttachmentSize
file-ppt.gif1.03 KB

#6

BStewart - June 25, 2007 - 04:39

I am trying to figure out how to do this as well. I saw that there was a "patch" as an attachment to one of the responses, but I don't know how to apply it. I only see what appears in the browser window when clicking on the link.

Any assistance you can provide would be fantastic.

Thank you!

#7

jeeves - July 1, 2007 - 21:39

I tried running the patch against the 5.x-1.x-dev version. No success, here is a copy of what went on:

# patch -p0 < fieshare-icon-ppt-vsd.patch
patching file fileshare.module
Hunk #1 FAILED at 701.
1 out of 1 hunk FAILED -- saving rejects to file fileshare.module.rej
patching file fileshare.css
Hunk #1 FAILED at 69.
1 out of 1 hunk FAILED -- saving rejects to file fileshare.css.rej
patching file .cvsignore
clubecdc@ecdclub.org [~/public_html/modules/added/fileshare]#

My guess is I was not patching the correct version, but 5.x-1.x-dev appears to be the only one available.

#8

CESSoC - August 8, 2007 - 01:14
Version:HEAD» 5.x-1.0
Status:patch (code needs review)» fixed

Hello dear friends, my english not so good but we'll try...

I've tried to find a solution with FileShare module to display icons without using the prewiews system integrated within the module. So I've written a snippet to fix it with basic icons to display (PDF, XLS, DOC, ZIP, PPT and HTML). This code is very basic but helps me a lot. So here it is... and it works very well (see the sceenshot in attachment). The version of the module that you can find at the first line of the file is :
// $Id: fileshare.module,v 1.21.2.4 2007/02/12 19:29:32 jamier Exp $

1) First of all, in the fileshare.css, I de-activate the background image of files (line 56) :
/*background: url(file.gif) left no-repeat;*/
I replaced the original folder_open.gif too to have a more visual effect when the folder is open

2) I created an image folder in modules/fileshare/images and add some images (16x16 pixels gifs). I can send you in a zip if you want.

3) In fileshare.module, here's the code between the /////// . This is to place at the very bottom of the file, around line 685

4) I have to review the code to display an image in case of the file can't respond to the "if" conditions. I think it's more convenient to use "switch" and "case" and to end with a default image. Let's consider that my site will never display other types of files for the moment, so it'ok for me with that code.

$preview = $node->_basepath.$node->_filepath.'/_previews/'.substr($file[$x],0,-3);
          $exts = array('jpg','gif');
          foreach ($exts as $ext) {
            if (file_exists($preview.$ext)) { // check to see if preview file is there
              $output .= '<img src="'.base_path().$preview.$ext.'" border="0" align="absmiddle">'."\n";
            }

          }
        }
////////////////////////////////

<?php
$image
= array (substr($file[$x],-3));
   
  if (
in_array ('pdf', $image)) {
   
$output .= '<img src="modules/fileshare/images/pdf.gif" border="0" align="absmiddle"> ';
  }
  if (
in_array ('doc', $image)) {
   
$output .= '<img src="modules/fileshare/images/doc.gif" border="0" align="absmiddle"> ';
  }
  if (
in_array ('xls', $image)) {
   
$output .= '<img src="modules/fileshare/images/xls.gif" border="0" align="absmiddle"> ';
  }
  if (
in_array ('ppt', $image)) {
   
$output .= '<img src="modules/fileshare/images/ppt.gif" border="0" align="absmiddle"> ';
  }
  if (
in_array ('zip', $image)) {
   
$output .= '<img src="modules/fileshare/images/zip.gif" border="0" align="absmiddle"> ';
  }
  if (
in_array ('tml', $image)) {
   
$output .= '<img src="modules/fileshare/images/web6.gif" border="0" align="absmiddle"> ';
  }
?>

//////////////////////////////////

        $output .= $file[$x];
        if ($download) { $output .= "</a>\n"; } else { $output .= "</div>\n"; }
        $output .= '</div>'."\n";
      }
    }
  }
  closedir($handle);
...

AttachmentSize
Image 9.png53.67 KB

#9

Anonymous - August 22, 2007 - 07:38
Status:fixed» closed

#10

Ulti - January 4, 2008 - 11:33

For anyone who wants more of an MS Windows look and feel here are some folder opened and closed icons. ;)

This module is really great, just what I needed for the site I'm building. Thanks for all the work you've put in to it!

AttachmentSize
folder_open.gif446 bytes
folder.gif705 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.