Add mime picto

This commit is contained in:
Laurent Destailleur 2008-04-30 00:18:35 +00:00
parent 79306a55d3
commit 1fa8bbf08e
21 changed files with 37 additions and 12 deletions

View File

@ -1186,6 +1186,31 @@ function img_allow($allow)
} }
/**
* \brief Show mime picto
* \param file Filename
* \return string Return img tag
*/
function img_mime($file)
{
$mime='other';
if (eregi('\.pdf',$file)) { $mime='pdf'; }
if (eregi('\.(html|htm)',$file)) { $mime='html'; }
if (eregi('\.txt',$file)) { $mime='other'; }
if (eregi('\.php',$file)) { $mime='php'; }
if (eregi('\.pl',$file)) { $mime='pl'; }
if (eregi('\.js',$file)) { $mime='jscript'; }
if (eregi('\.(png|bmp|jpg|jpeg|gif)',$file)) $mime='image';
if (eregi('\.(mp3|ogg|au)',$file)) $mime='audio';
if (eregi('\.(avi|mvw|divx|xvid)',$file)) $mime='video';
if (eregi('\.(zip|rar|divx|xvid)',$file)) $mime='archive';
$alt='Mime type: '.$mime;
$mime.='.png';
return '<img src="'.DOL_URL_ROOT.'/theme/common/mime/'.$mime.'" border="0" alt="'.$alt.'" title="'.$alt.'">';
}
/** /**
\brief Return if a filename is file name of a supported image format \brief Return if a filename is file name of a supported image format
\param file Filename \param file Filename

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B