I was wondering if there could be a way for the module to search the directory it is listing, and as it parses the file names, check to see if a matching file name with a graphical extension (.gif, .jpg or .png) is found, and if so, print the image (using imagecache resizing) to display in the description field. (Particuarly for ebook directories. Where it can show the book covers in the description field (or even a 'cover' field)? Perhaps even making a flag in the directory listing setup page to flag that the directory should use covers if available? I doubt many would find this useful, but I know I certainly would. Thanks.

Jim

Comments

greywolfsspirit’s picture

To give a rough idea of how I would like the display to look:

____________________________________________________________________________________________________
[ ] | Mimetype Icon | Display Name | Book Cover graphic (100x100) thumbnail | Size of File | Description |
-----------------------------------------------------------------------------------------

and perhaps the ability to click the thumbnail, and bring up a panel showing the original image size? In theory, it should work fine, I just don't know how to code it. Even if it could be a views page created for just directory types of ebook or software or something along those lines. It could even be used for inline thumbnailing of image directories, where a preview of available clip art could be displayed on screen before downloading it and finding it isn't a graphic you wanted, saving the user time.

Jim

greywolfsspirit’s picture

Can anyone offer help with a patch to accomplish this? Basically what I need is a way to patch this to search for the filename, check if there is a matching file name with a graphic extension (jpg, gif, png), then run the image through imagecache to set the thumbnail size to like 200x200 if the thumbnail doesn't pre-exist, then insert it before the description field contents. I'm not familiar enough with coding Drupal to do this. Yes, I could just add a filefield and manually add the pictures in one by one, but if this could be automated, it would be greatly appreciated.

Yoran’s picture

Status: Active » Fixed

Never hesitate to send me a contact form when you need something.
This can be easily be done without patching filebrowser, simply by adding a preprocess_node function in your theme like this :

function mytheme_preprocess_node(&$vars) {
  $node = $vars['node'];
  if ($node->type=='dir_listing') {
    foreach ($node->file_listing as $file) {
      if (!isset($node->content['illustration']) && strpos($file['mime-type'], 'image/')===0) {
        $variables['illustration'] = theme('imagecache', 'illustration', $node->folder_path.$file['relative-path']);
        break;
      }
    }
  }
}

After you just have to make a type specific node template (node-dir_listing.tpl.php) which will make use of the new $illustration variable.

Status: Fixed » Closed (fixed)

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

johnv’s picture

Title: Wondering if this could be patched in.. » How to show an ImageCache thumbnail for each file.

just making the title clearer for later reference.