Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2008
    Location
    USA
    Posts
    40
    Thanks
    3
    Thanked 1 Time in 1 Post

    Make a Custom Gamercard-Like Generator Using PHP

    I've been pulling my hair out trying to do this, so I figured it was time for some help from the experts.

    I am trying to create a PHP script that can generate an image with another image and some text in it that is selected from a database. Since this is quite hard to explain, I will use GamerCards as my example. If any of you have seen GamerCards before, you can see that they consist of one image that might have an avatar of some sort plus some other text that has been compiled into one image and is updated automatically.

    Here is an example of a GamerCard that I made for Oblivion:



    As you can see, the GamerCard-like image listed above contains a small image on the left that is chosen by the user when using the GamerCard generator coded in PHP. Also, you can see some other images and text placed in columns and rows throughout my example image above. Here are my biggest problems:
    • I need to develop a PHP script that allows a user to enter a URL for the image and enter some text for the other things listed in my GamerCard and, once the generator is submitted, have a new image created with all of the text compiled into one image.
    • I need it to be able to update automatically without creating a new URL when information in the database that is listed in the image is changed.

    Please, I really need help here. If you do not understand what I am asking, feel free to ask me to elaborate on any of my points. I will very much appreciate any help that I get, and please ask me questions if you need to better understand my question. I don't mind taking it one step at a time to develop this script, I just want it developed, please. Thank you!

    PS: If anyone can tell me how to use HTML in PHP arrays, that will help me just as much!
    Last edited by legohalflife2ma; 12-13-2008 at 12:54 AM.

  • #2
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    I really don't quite understand myself. I thought you were talking about a Image Cache, but then it sounds like over lapping images, and inserting text.

  • #3
    New Coder
    Join Date
    Mar 2008
    Location
    USA
    Posts
    40
    Thanks
    3
    Thanked 1 Time in 1 Post
    Well, have you ever seen those GamerCards? I would like to make a sort of GamerCard generator where a user types in a bunch of data in various input fields, uploads a small picture, and then submits the generator form and a .png image is created and stored in my webspace that has the image that the user uploaded plus all of the text that they typed in the input fields all placed on the image and complied into a .png file. Here is an example of a GamerCard generator so that you can get the idea of what I am trying to do: http://www.mygamercard.net. As you can see there, it asks you for some information and then, once submitted, it generates an image called a GamerCard with other images and text compiled into it. Now, the website I showed you puts text and images in that GamerCard that have been taken from a database, but it's pretty much the same thing that I want to do.

    I was using this tutorial to try to create an image with other text and images compiled into it. Maybe taking a quick look through that tutorial will give you an idea of what I am trying to accomplish. The problem that I had with that tutorial was that, although it allowed me to enter text and have it compiled into one .png image, it used PHP arrays to place the text in the image and I could not put HTML formatting into that image.

    Maybe that will help you to better understand what I am asking. Thanks for your reply, by the way!

  • #4
    Regular Coder
    Join Date
    Dec 2005
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I completely understand what your wanting. I have done the exact same thing, but instead it was a company profile image.

    Tips for you.
    1. Make sure all the 'Text' your having loaded into the image is stored in a Database.
    2. For the images you allow them to upload, I would have converted into Base64 (using php) and store that into the database also.
    3. I would write one master script that will be used to make ALL 'GamerCards', then you pull out the gamer card, use a URL like (script.php?GamerID=8656)
    4. Make sure on that script to print your header for your image type, header('Content-Type: image/PNG');

    Read This Chapter - http://us3.php.net/gd

    If you read through that chapter, you will find what your doing is rather simple. Or at least I can be, I remember my first attempt was a little hard. the GD and MING extensions inside PHP happen to be my fav. So feel free to ask further questions.

    PS.. you said something about (arrays), mmm thats candy to, what is your question on its usage? Arrays are your best friend, but without understanding them, their your worst friend.

    http://us3.php.net/array


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •