Server Help

Trash Talk - Php 5 + MySQL (and bonus lvl previews!)

Mine GO BOOM - Tue Jan 30, 2007 6:52 pm
Post subject: Php 5 + MySQL (and bonus lvl previews!)
While adding another feature to the forums because I wanted to do it a long time ago, I needed to upgrade apache's php version from 4 to 5. Simple apt-get install libapache2-php5 and I thought I was on my way. Refresh a sample php file, works. Go to browse the forums, nothing, not even an error.

Ugh. Look in apache error output. Nothing. Hmm, weird. Run php index.php on the console, outputs the forums fine. What the hell? Dig around apache's new php5 configs, everything the same as before except 4 replaced with 5. Started throwing die('error'); into index.php to find what line causing it to fail. Narrow down to an include, which includes another file, which includes another file. Get down to db.php, and started adding it into sections until I found the line. mysql_connnect. Hmm.. but the CLI of php worked. Search php.net for answers.

In php4, mysql was built in. In php5, mysql is optional and not enabled by default. Edit php.ini to enable mysql, works again.

Now back to what I was adding. A while ago, CypherJF made a php script to convert lvl files into images. I thought it was a good idea, and made a note to include it into these forums, mostly for the lazy people who upload their lvl files to their zone description when they advertise, but don't include an image version. So, I added it.

While writing up this post, I thought the way it was implemented was a bit off. If using for phpbb only, why not just handle the fileid direct instead of going in a round about way, since presentation name is not always the same as the physical name. And doing height/width = 512 sounds a bit cheap, since most images should be scaled proportionally. Added scale=% factor. And when scaling, the lines are not always included in smaller images, so used imagecopyresampled instead of imagecopyresized. When an image becomes smaller, the lines fade into the black background, needed to fix that. Added in imagegammacorrect. If you want to override the gamma correction (which is applied to every image), add &gamma=1 to the url.

Now below every lvl attachment are two preview links, one to full size, one to half size.

CypherJF - Tue Jan 30, 2007 7:28 pm
Post subject:
Nice! icon_smile.gif This made my day to see someone put it to use.
Cerium - Tue Jan 30, 2007 9:22 pm
Post subject:
Very cool, though the colors aren't the standard radar colors, but whatever.
A guy going by the eHandle of Mystery Meat also made a Cpp app to do this and (no slam on you Cypher) it did an amazing job of duplicating the map. If I can find it, I'll post it.

MGB, is that actually a gamma character or a lowercase y? I can't tell and I'm too lazy to check.
CypherJF - Tue Jan 30, 2007 10:01 pm
Post subject:
I based the color scheme off of FACTS which has map deconvert which takes a LVL and outputs as BMP.
BDwinsAlt - Tue Jan 30, 2007 10:06 pm
Post subject:
Very cool. I had that same problem with php 5 also. I'm glad you figured it out. If I ever mess with it again I'll know exactly what to do. I like that map thing. Saves everyone a lot of trouble. sa_tongue.gif
Mine GO BOOM - Tue Jan 30, 2007 10:07 pm
Post subject:
Cerium wrote:
MGB, is that actually a gamma character or a lowercase y? I can't tell and I'm too lazy to check.

Thank you for catching that. It was an actual gamma character, because what I meant to type was &gamma which was converted by the browser into the real character.

Now if someone wants to make an lvz->ini converter, I'll throw that up on the board the same as how lvl are handled.
Cerium - Wed Jan 31, 2007 2:43 am
Post subject:
Got it:

Quote:
The exe file is at

http://jacob.leverich.org/subspace/lvlmeat.exe

Source code is attached. I think this is the latest version. Haven't touched it in a couple of years.

Try "lvlmeat -b map.bmp map.lvl"

Cheers,
-jacob

----------

It's a little nasty; no comments. Originally compiled for Windows with DJGPP, but VS.NET will probably work.



Apparently the functionality is a tad different. He used this program to make the massive BMP, then used photoshop to reduce it to a thumbnail. The result though, was beautiful (example below).
K' - Sat Feb 03, 2007 4:19 am
Post subject:
Lovely.

Quote:
Mystery Meat

That sounds more scary than words can describe.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group