Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP Dynamic Text Generator
#1
I seen some PHP scripts a while ago where it makes a random quote into an image and then adds something to the end saying "This has been viewed X times" and it makes it into one image. I think it was called GDI or GD or something like that. How do I do this, can anyone link me to some tutorials or anything?
[Image: image.php]
Reply
#2
http://www.supportforums.net/showthread.php?tid=302

That's a tutorial on how to create a image with PHP, note that you can save the image by calling;
PHP Code:
imagepng($img'path/to/your/save/folder/image.png'); 

All you need to do now is save the newly created image into a database if there isn't already the same one, the databse table would look like...
id
name
path
views

All you need to do next is count entries in the tale and load a random one and display it, and also update the views field...
Simple...
Reply
#3
Cool that tutorial really helped me understand the basics, I liked how you explained each code.
I took the basics from your code to create this:

[Image: image2.php]
[Image: image.php]
Reply
#4
Thank you, but I've noticed that I have missed one point and I can't edit the post anymore...

After calling imagepng() one should release the used memory, in many cases this is not really a needed step because the PHP GC does a great work, but it is a good practice;

PHP Code:
imagepng($img);
# and after that call you can free used memory by calling
imagedestroy($img); 

I've written more tutorials on GD, feel free to look for them in PHP category, or just browse through my Threads...
Reply
#5
Looks nice, seems to work in your signature. I wanted to make something like that, but I never decided to take time out and do it Smile

Perfectly fine with my current signatures.
Reply
#6
The image does look cool, good work there...
Glad I could help you...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP Framework List: An Ultimate Guide to 102 PHP Frameworks for Web Developers tk-hassan 0 936 07-27-2020, 11:26 PM
Last Post: tk-hassan
  Creating Dynamic images with PHP Gaijin 15 8,198 01-21-2012, 06:17 PM
Last Post: Dube
  How hard would it be to make an signature generator? Extornia 3 1,402 01-11-2012, 08:24 PM
Last Post: Gaijin
  [SF Coders] Password Generator ★Cooldude★ 8 3,103 12-07-2011, 12:42 PM
Last Post: ★Cooldude★
  Use PHP in a text file? Blic 4 1,508 10-25-2011, 08:12 PM
Last Post: Project Evolution

Forum Jump:


Users browsing this thread: 1 Guest(s)