FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Making A PHP sig...





The-Master
How would I go about making a cool sig like this:



Refresh the page to see another sig...This is a major subliminal message. Please email me if you find it as I think it is really cool. My email address is the-master@supanet.com Anyway Congratulations if you found this as I really did think that no one would ever find it and it would be one of those things on the Internet that no one will ever find like one of those free sites that no one ever visits. Not like ones made on this site they are cool!!! I love this site and thanks for it.
jeremyyak
Thats pretty cool.
Is it just a randomizer or does it do somthing else spiffy?

Smile
~Jeremy~
bladesage
The-Master wrote:
How would I go about making a cool sig like this:



Refresh the page to see another sig...


I believe I've got just the thing for you ^_^.

I developed this awesome tool for making dynamic images, it even has additional notes at the final step for how to make it work on forums. It's a simple, step-by-step process, just follow the on-screen directions, and there you go! A dynamic image. It currently supports 2 different types of images.

Please visit my site (which is still under construction, but that wizard works just fine) and test it out for me. I tested it thoroughly myself without any problems (besides a few revisions), but I'd love for someone else to try it out for me as well.
mathiaus
Option B is LONG .......
Quote:
Code:
if( $choice == 1 ) {
$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
$str = "hello";
imagestring($img, 3, 5, 5, $str, $txclr);
}

if( $choice == 2 ) {
$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
$str = "boo";
imagestring($img, 3, 5, 5, $str, $txclr);
}

if( $choice == 3 ) {
$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
$str = "bye";
imagestring($img, 3, 5, 5, $str, $txclr);
}

Could be
Code:
$str[0] = "hello";
$str[1] = "boo";
$str[2] = "bye";

$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
imagestring($img, 3, 5, 5, $str[$choice], $txclr);


And when copied and pasted, the code doesnt keep line breaks or indents Crying or Very sad
There isn't much difference here but where you have lots of options (10+) it will make a large difference!


Ok the same witn option A as well. Change all the IF's, add the urls to an array and read the array[$choice];
bladesage
mathiaus wrote:
Option B is LONG .......
Quote:
Code:
if( $choice == 1 ) {
$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
$str = "hello";
imagestring($img, 3, 5, 5, $str, $txclr);
}

if( $choice == 2 ) {
$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
$str = "boo";
imagestring($img, 3, 5, 5, $str, $txclr);
}

if( $choice == 3 ) {
$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
$str = "bye";
imagestring($img, 3, 5, 5, $str, $txclr);
}

Could be
Code:
$str[0] = "hello";
$str[1] = "boo";
$str[2] = "bye";

$img = imagecreate(50, 22);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
imagestring($img, 3, 5, 5, $str[$choice], $txclr);


And when copied and pasted, the code doesnt keep line breaks or indents Crying or Very sad
There isn't much difference here but where you have lots of options (10+) it will make a large difference!


Ok the same witn option A as well. Change all the IF's, add the urls to an array and read the array[$choice];


Well, I revised the scripts, using arrays, and instead of using htmlspecialchars() I just used str_replace() to change < and > to &lt; and &gt; (so now it keeps all the line breaks (for me at least)).

So an entire script for random strings (12 in this case) looks like
Code:
<?php

/*
/ Created by Scriptors' Resort dynamic image creator
/ For this and many more tools and scripts, visit http://s-resort.Aedolis.com
*/


header("Content-Type: image/png");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");


$choice = rand(0, 11);

$strings[] = "Green is a color";
$heights[] = 23;

$strings[] = "I like cheese";
$heights[] = 23;

$strings[] = "My name is Alex";
$heights[] = 23;

$strings[] = "Pie is edible";
$heights[] = 23;

$strings[] = "Green is a color";
$heights[] = 23;

$strings[] = "I like cheese";
$heights[] = 23;

$strings[] = "My name is Alex";
$heights[] = 23;

$strings[] = "Pie is edible";
$heights[] = 23;

$strings[] = "Green is a color";
$heights[] = 23;

$strings[] = "I like cheese";
$heights[] = 23;

$strings[] = "My name is Alex";
$heights[] = 23;

$strings[] = "Pie is edible";
$heights[] = 23;

$img = imagecreate(350, $heights[$choice]);
$bgclr = imagecolorallocate($img, 0, 0, 0);
$txclr = imagecolorallocate($img, 255, 255, 255);
imagestring($img, 4, 5, 5, $strings[$choice], $txclr);
imagepng($img);

?>

And an entire script for random images (type A) is
Code:
<?php

/*
/ Created by Scriptors' Resort dynamic image creator
/ For this and many more tools and scripts, visit http://s-resort.Aedolis.com
*/


$choice = rand(0, 7);

$images[] = "http://defection.frih.net/defpro.png";
$images[] = "http://www.itsfake.com/bin/fake-img.jpg";
$images[] = "http://www.itsfake.com/bin/fake-img.jpg";
$images[] = "http://www.itsfake.com/bin/fake-img.jpg";
$images[] = "http://www.itsfake.com/bin/fake-img.jpg";
$images[] = "http://www.itsfake.com/bin/fake-img.jpg";
$images[] = "http://www.itsfake.com/bin/fake-img.jpg";
$images[] = "http://www.itsfake.com/bin/fake-img.jpg";

readfile($images[$choice]);

?>


Thanks for helping me test it, and let me know if there are any other problems.
The-Master
Thanks alot guys and bladesage your site really helped. One last question though. How would I go about having a clasic forum sized image, (displaying a random image) with some random writing over it?

Thanks in advance Very HappyThis is a major subliminal message. Please email me if you find it as I think it is really cool. My email address is the-master@supanet.com Anyway Congratulations if you found this as I really did think that no one would ever find it and it would be one of those things on the Internet that no one will ever find like one of those free sites that no one ever visits. Not like ones made on this site they are cool!!! I love this site and thanks for it.
deepak
Use any of the image lib for PHP and you could make on the fly images with dynamic data.
bladesage
Tell you what, I'll set a type C in the wizard (maybe a type D too). They should cover your needs, I'll let you know when I'm done.

I would love to explain it all to you, but it's very hard to explain. You can probably learn a lot from the script(s) it makes for you.

I'll go as fast as I can, but my wrists do slow my work.

EDIT:
Since I recently learned how, I'll let the wizard display an approximate file size for the completed script Smile
Related topics
Php , Making Dynamic sig
Sig required.. urgent.. 300 FRIH$
PHP sig help[solved]
How To : Improve Your PHP Programming
Simple login system
Make me a sig for FRIH$100: imagination req. [CLOSED]
Selling Sigs
Frih$ poll (read before voting)
How much time do u spend on computer?
How do you generate forum traffic?
Progam to design your website
[*RESOLVED*] Please close for me.
Adding a save as feature
LOCK _ LOCK _LOCK_LOCK_PLEASE
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.