1 Reply Latest reply on Nov 12, 2008 12:31 PM by Günter Schenk

    Different icons for different files

      I have to build a website allowing clients to upload files. That's ok, I can use ADDT to do this. However, some files maybe word files, some maybe DWG files or jpg files. How can I display a thumbnail of each file? Is this possible?

      Thanks in advance.
        • 1. Re: Different icons for different files
          Günter Schenk Level 4
          Hi silverbadger, <br /> <br />loosely said, you will have to let PHP extract the file suffix (.jpg, .doc) from the name, and display the desired icon for each suffix. <br /> <br />Here´s a pretty basic sample script to get you started: <br /> <br />------------ <br /><?php<br />$file = strtolower($row_queryname['filename_column']);<br /><br />if (substr($file, -4) == ".jpg") {<br />$icon = "icon_jpg.gif";<br />}<br /><br />else if (substr($file, -4) == ".doc") {<br />$icon = "icon_doc.gif";<br />}<br />?> <br />----------- <br /> <br />As you´ll assumingly be displaying the file list as Repeat Region, you´ll need to place the abovementioned script block within the repeat region -- if placed outside, $file = $row_queryname['filename_column'] would just display the very first record. <br /> <br />However, the variable "$icon" is what you´ll need to define as image source for the to-be-displayed file icons <br /> <br />Cheers, <br />Günter Schenk <br />Adobe Community Expert, Dreamweaver <br /> <br />Cheers, <br />Günter Schenk <br />Adobe Community Expert, Dreamweaver