PHP Image Class

Questions about programming languages and debugging
Post Reply
User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

PHP Image Class

Post by Gogeta70 »

Out of a personal interest of mine, and some mild boredom, i made a PHP class that will take a set of 32x32 pixel images and tile them across a larger image. Good for generating quick boards for rpg's or something.

Anyway, here's the code:

http://code.suck-o.com/38845

And an example: http://gogeta.homeip.net/img

To generate that image, all i had to do was put this code in the index file:

Code: Select all


include("Image.php");

$z = 32*20;

$img = new Image($z);
$img->setTileType('grass', 8);
$img->setTileDir('./tiles/');
$jpeg = $img->Generate();

header('Content-type: image/jpeg');

imagejpeg($jpeg);

And here are the tiles i used: http://gogeta.homeip.net/img/tiles

^_^

Enjoy.

Edit:

I forgot to mention that the code will put out a jpeg but it will only read GIF images for the tiles. It also supports transparency in the gif images.
¯\_(ツ)_/¯ It works on my machine...

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

oh, nice... :D
me might use it for ads, like the lucky guy with his million dollar site did where only thumbnail sizes ads were displayed... :lol:
Image

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Lol, yeah i remember that site...
¯\_(ツ)_/¯ It works on my machine...

Post Reply