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.

Comments

JamieR’s picture

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

Jamie.

JamieR’s picture

Status: Active » Fixed
malcomm’s picture

Status: Fixed » Needs review
StatusFileSize
new1.64 KB

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

malcomm’s picture

StatusFileSize
new637 bytes

VSD icon

malcomm’s picture

StatusFileSize
new1.03 KB

PPT icon

BStewart-1’s picture

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!

jeeves’s picture

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.

CESSoC’s picture

Version: master » 5.x-1.0
Status: Needs review » Fixed
StatusFileSize
new53.67 KB

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";
            } 
			
          }	
        }
////////////////////////////////

 $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);
...
Anonymous’s picture

Status: Fixed » Closed (fixed)
Ulti’s picture

StatusFileSize
new446 bytes
new705 bytes

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!