Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

File Type Icons

edited December 2006 in Vanilla 1.0 Help
Since a lot of files might not be images, what about having a set of file type icons that appear? This is similar to the Windows or Mac OS. I'm getting mostly "Preview Unavailible" on all my files, it would be nice to have a visual reference there. Specifically, if you can get permission, the Elements Icon Suite has some great file type icons: http://www.deviantart.com/deviation/15949688/ http://www.aqua-soft.org/board/showthread.php?t=23874

Comments

  • I wouldn't mind just doing this just for my own installation. Can you give me some help? I just need to insert the file extension, but can't figure out which variable to use. This is where it decides whether or not to use a Thumbnail. I've got a folder full of PNG files that are named according to file exensions. $Return .= "<li class=\"ItemThumb\">" ."<a href=\"".CurrentUrl().$Params->GetQueryString()."\" style=\"background:url('icons/".$Extension.".png') center center no-repeat;\">" ."<img src=\"icons/".$Extension.".png\" width=\"100\" height=\"100\" border=\"0\" alt=\"\" />" ."</a>" ."</li>"; } Is there a variable I can use here?
  • MarkMark Vanilla Staff
    Does it actually have fixed dimensions like that? If so, it shouldn't. *kicks self* Okay, let me take a look and see what you need to do.
  • MarkMark Vanilla Staff
    edited July 2005
    Okay, change this:
    if ($CurrentFileHasThumbnail) {
    $ThumbPath = EncodeLinkUrl(FilePath($Path, "_thumb.".$Name));
    $Return .= "<li class=\"ItemThumb\">"
    ."<a href=\"".CurrentUrl().$Params->GetQueryString()."\" style=\"background:url('".$ThumbPath."') center center no-repeat;\">"
    ."<img src=\"".$ThumbPath."\" border=\"0\" alt=\"\" />"
    ."</a>"
    ."</li>\r\n";
    } else {
    $Return .= "<li class=\"ItemThumb NoPreview\">"
    ."<a href=\"".CurrentUrl().$Params->GetQueryString()."\">"
    ."Preview Unavailable"
    ."</a>"
    ."</li>";
    }
    To this:
    if ($CurrentFileHasThumbnail) {
    $ThumbPath = EncodeLinkUrl(FilePath($Path, "_thumb.".$Name));
    $Return .= "<li class=\"ItemThumb\">"
    ."<a href=\"".CurrentUrl().$Params->GetQueryString()."\" style=\"background:url('".$ThumbPath."') center center no-repeat;\">"
    ."<img src=\"".$ThumbPath."\" border=\"0\" alt=\"\" />"
    ."</a>"
    ."</li>\r\n";
    } else {
    $aName = explode(".",$Name);
    $Extension = "";
    if (count($aName) >= 2) $Extension = strtolower($aName[count($aName)-1]);
    if ($Extension == "") {
    $Return .= "<li class=\"ItemThumb NoPreview\">"
    ."<a href=\"".CurrentUrl().$Params->GetQueryString()."\">"
    ."Preview Unavailable"
    ."</a>"
    ."</li>";
    } else {
    $ExtensionImage = "/path/to/extension/images/".$Extension.".png";
    $Return .= "<li class=\"ItemThumb\">"
    ."<a href=\"".CurrentUrl().$Params->GetQueryString()."\" style=\"background:url('$ExtensionImage') center center no-repeat;\">"
    ."<img src=\"".$ExtensionImage."\" border=\"0\" alt=\"\" />"
    ."</a>"
    ."</li>\r\n";
    }
    }
  • Mark, thank you! Check it out: http://kylehaskins.com/filebrowser.jpg I did have to resize all the images to be 100 x 100. But I was able to do a batch resize with imageready.
  • MarkMark Vanilla Staff
    Nice one :)
  • i'm completely confused by this. should i be? i have the thumbnails i want (though not uploaded) but am completely confused by the script
  • wow u really awoke an old thread lol.
This discussion has been closed.