Welcome to Dream.In.Code
Become a PHP Expert!

Join 149,943 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,409 people online right now. Registration is fast and FREE... Join Now!




How does this work?

 
Reply to this topicStart new topic

How does this work?, Pokemon Trainer Card Generator

DeceitfulPillow
26 Aug, 2008 - 09:05 PM
Post #1

New D.I.C Head
*

Joined: 22 Jun, 2008
Posts: 26



Thanked: 1 times
My Contributions
Okay, if you have ever used a Pokemon Trainer Card Generator, then you know what I'm talking about. If not, it's basically a set of forms that you simply choose sprites in drop down menus add your name and the like, then click generate. It then adds those sprites to curtain sections of a larger image, aka: the Trainer Card. It has the sprites, your name and the other info you placed into it.

Here is an example: I'm not sure if I'm allowed to place links to other sites in posts though so please don't gripe at me.

http://www.upokecenter.com/misc/teamgen.php

I really would like to know how they work and are made. Especially the code. Thank you.

This post has been edited by no2pencil: 26 Aug, 2008 - 09:09 PM
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: How Does This Work?
26 Aug, 2008 - 09:33 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,655



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
PHP comes with a graphics library called GD which is used in generating graphics "on the fly". It is a standard package that comes with PHP and is often compiled with PHP when it is installed.

The library can create picture with PHP commands. This allows people to generate whatever pictures they want, write text into the picture, add their own effects etc.

In the case of this generator the programmer creates a picture and then displays it to the users as a GIF/JPG/PNG picture. I have created many scripts like this for things like generating charts for statistical website data.

Below is a link to the section of PHP.net which describes how these various image functions work...

PHP: GD - Manual

Now this isn't the only library you could use, but it is one of the most popular. As you will see from this link above there are tons of functions that can be used for creating shapes, lines, putting pictures in other pictures (like the little pokemon graphics on the card) etc.

So read through the pages there and check out their examples section for a simple example of generating a PNG file (just like the trainer card).

PHP: GD Examples - Manual

Hope this helps!

"At DIC we be pokemon training code ninjas... I single handedly trained Zangoose but he ran away because he claimed I was a bad parent. All pokemon have to eat their brussel sprouts" decap.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 04:49PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month