Optimize file icons

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
Hello.

I noticed a css sprite for 48px icons but not for 24px. I also noticed that the css for this is not well optimized.

I'm attaching 2 css files and one image for the 24px icons. To use this new css, just add the 2 classes in the element. Example: <a class="icons_24px sprite_24_exe" name="link"></a>

And also, the script uses the file_exists function to check the extension, if the file doesn't exists a default icon is used. This is inefficient. Just create an array with all the extensions and use the in_array function (and make sure you don't create the same array on each icon over and over). file_exists() performs an I/O operation and we should avoid those. Imagine a folder with 200 files; the script will check if each icon exists in the folder.
 

Attachments