CodeIgniter Forums
Compressed Asset Provider - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Compressed Asset Provider (/showthread.php?tid=4375)



Compressed Asset Provider - El Forum - 11-20-2007

[eluser]Pygon[/eluser]
Hello all. Been playing around with something. Unfortunately, I, like many people, do not have ZLIB on my production PHP install, but I need a way to provide gzip'd assets (css, js, jpg, jpeg, gif, png, bmp).

Therefore, I present Combust (codename, we'll see if I stick with it), a compressed asset provider.

Advantages:
- caching of gzipped files
- ZLIB not required on your production system, gzip-cache the file locally, then copy to your server.
- if no ZLIB, content will be servered as normal

*Just a note: This is a rought sort of 'alpha' version. Feel free to make suggestions or contribute.*

Usage:
Load the AssetProvider library.

set_directory( <directory> ) - sets the working base directory. Automatically set to APPPATH. Cannot be set outside of server root.

send_file( <path/to/filename>,<enable caching T/F> ) - will not accept a path outside of the current working directory for safety -- preventing user submission of "../../../file/outside/server". Second parameter determines whether file should be cached.

library/AssetProvider.php on privatepaste

*One last note: Really, this is rough code. I'll be refining it over the coming weeks and will continue to update it if there is interest.*


Compressed Asset Provider - El Forum - 11-20-2007

[eluser]Pygon[/eluser]
Next update (tomorrow):
- disallow filetypes such as php, inc, etc
- anything else I think of tonight


Compressed Asset Provider - El Forum - 11-20-2007

[eluser]Derek Allard[/eluser]
Looks nice, and can't wait to see where you go with this. I'm moving this post into "ingited code" to give it the attention it deserves.