 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Mine GO BOOM Hunch Hunch What What

Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Tue Jan 30, 2007 6:52 pm Post maybe stupid 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.
speed.lvl - 60.49 KB
LVL Preview: Full Size - Half Size
File downloaded or viewed 14 time(s)
Last edited by Mine GO BOOM on Tue Jan 30, 2007 10:05 pm, edited 1 time in total |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Tue Jan 30, 2007 7:28 pm Post maybe stupid Post subject: |
 |
|
|
|
Nice! This made my day to see someone put it to use. _________________ Performance is often the art of cheating carefully. - James Gosling
|
|
Back to top |
|
 |
Cerium Server Help Squatter

Age:42 Gender: Joined: Mar 05 2005 Posts: 807 Location: I will stab you. Offline
|
Posted: Tue Jan 30, 2007 9:22 pm Post maybe stupid 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. _________________ There are 7 user(s) ignoring me right now.
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Tue Jan 30, 2007 10:01 pm Post maybe stupid Post subject: |
 |
|
|
|
I based the color scheme off of FACTS which has map deconvert which takes a LVL and outputs as BMP.
|
|
Back to top |
|
 |
BDwinsAlt Agurus's Posse

Age:34 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
Posted: Tue Jan 30, 2007 10:06 pm Post maybe stupid 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.
|
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Tue Jan 30, 2007 10:07 pm Post maybe stupid 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.
|
|
Back to top |
|
 |
Cerium Server Help Squatter

Age:42 Gender: Joined: Mar 05 2005 Posts: 807 Location: I will stab you. Offline
|
Posted: Wed Jan 31, 2007 2:43 am Post maybe stupid 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).
Example!
map3.jpg - 114.57 KB
File downloaded or viewed 27 time(s)
Source!
lvlmeat.c - 13.97 KB
File downloaded or viewed 19 time(s)
|
|
Back to top |
|
 |
K' You can win any war if you start a year early

Gender: Joined: Jul 13 2006 Posts: 271 Location: Southtown Offline
|
Posted: Sat Feb 03, 2007 4:19 am Post maybe stupid Post subject: |
 |
|
|
|
Lovely.
That sounds more scary than words can describe.
|
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 34 page(s) served in previous 5 minutes.
|