PHP File Packager

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

PHP File Packager

Post by LiquidPro »

I was thinking of a way to go about compressing and decompressing files with a PHP script. You'd simply upload your script to the webserver, it'd automatically unpackage them to a temporary place (filesystem or database). Then it would delete them when you were done using them.

This was my original thought:
a pattern 10 characters long could be compressed down to 6 characters. This would reduce the size of the file by almost half (40% smaller). Then I realized that would cause problems with the program confusing certain data with other data...

Anyone have any idea of a compression algorithm to use?

Note: This post was probably confusing as hell... sorry
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'd say, you might want to check out this book: Data Compression (ISBN 0-387-95045-1) by David Salomon. It's got some really great stuffs on differing algorithms for differing goals in compression.
LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

Post by LiquidPro »

Well... if I had the money to buy myself a book on it, I would... but I don't exactly.

Maybe I can find an eBook version of it somewhere.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

Post by LiquidPro »

I don't think you guys get me exactly... I'm wanting to create my own compression algorithm. I don't want to use an Open Source one or anything like that.

This is mostly just to create a crazy compression. I have one idea, which will be good and bad. If you have an extremely small file (3 characters) your package will end up being bigger. However, if you have a really big file, you will end up reducing the size by at least 50%
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

This is mostly just to create a crazy compression. I have one idea, which will be good and bad. If you have an extremely small file (3 characters) your package will end up being bigger. However, if you have a really big file, you will end up reducing the size by at least 50%
Check filesize before compression. If the file is already small enough, don't compress it. :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You can check the newsgroups of comp.compression or something like that, can't remember exactly.. but there are lots of people and articles about the schemes behind differing forms and applications of compression algorithms.
LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

Post by LiquidPro »

Very good solution!

I'll have to figure out the break even point, where compressing it doesn't do anything for it. If it's less than the break even point it won't compress it, if it's greater than it will!

Awesome idea, good thinking.
Post Reply