Welcome Guest, Not a member yet? Register   Sign In
Compressed Asset Provider
#1

[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.*


Messages In This Thread
Compressed Asset Provider - by El Forum - 11-20-2007, 04:28 PM
Compressed Asset Provider - by El Forum - 11-20-2007, 06:34 PM
Compressed Asset Provider - by El Forum - 11-20-2007, 08:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB