Rotator
Nov 19 2006, 02:08 PM
Hey Having browsed this and other sites I've come up with the following signature-code for generating text on an image: CODE <?php header("Content-type: image/png");
$select = rand(1,3); if($select==1)$img = "gow.png"; if($select==2)$img = "gow2.png"; if($select==3)$img = "gow3.png";
$image = imagecreatefrompng("$img"); //imagecolorallocate($image, R, G, B) in HEX values $font_white = imagecolorallocate($image, 255, 255, 255); $font_grey = imagecolorallocate($image, 128, 128, 128);
$select = rand(1,3); if($select==1)$string1 = "Achievement Status"; if($select==1)$string2 = "4395 Gamerpoints"; if($select==2)$string1 = "Latest Game"; if($select==2)$string2 = "Gears of War"; if($select==3)$string1 = "Latest Achievement"; if($select==3)$string2 = "Veteran of D-Day (Call of Duty 2)";
//($image, fontsize, rightindent, downindent, data, txtcolour) imagestring($image, 3, 7, 5, "Collection Status", $font_white); imagestring($image, 3, 7, 23, "48 Retail Xbox360 Titles", $font_white); imagestring($image, 3, 7, 41, $string1, $font_white); imagestring($image, 3, 7, 59, $string2, $font_white);
imagepng($image); imagedestroy($image);
?> However, it generates the text in the image in a standard font. Is there a way to make it use a different truetype font, one located on the same server as the php, but not installed on the hostmachine? I'm REALLY new to php, so please reply in plain english  Thanks in advance.
Reply
rvalkass
Nov 19 2006, 03:09 PM
I know it is possible to use a non-standard font on a signature as I did it a while ago. You have to upload the TTF font file to the same directory as the script for it to work. I haven't used it for a while, but I got the code from the PHP manual. Have a look over there and I'll root around and see if I can find the code I used.
Reply
Rotator
Nov 19 2006, 05:47 PM
I tried replacing imagestring with imagettftext and adding $font = 'lcd.ttf';. The lcd.ttf is uploaded to the same dir. I see the image as it's supposed to look, but no text...
Reply
truefusion
Nov 19 2006, 06:38 PM
Ah, my method is a bit different (see my sig block). I filled an array full of phrases, and used array_rand to randomly pick which one to display per load. I even made it to match the background of the forum. Just the profile background is a bit different. I chose the font Arial just so it can look plain. Other fonts would have worked, though. Btw, in the code you have shown, you don't specify which font to use, like i did in my code.
Reply
Rotator
Nov 19 2006, 06:57 PM
Now, how can I get to see your code? If you'll let me?  The first code I wrote didn't have any information about the font, because I didn't know what to do... But as I said, I tried imagettftext in conjunction with $font, but to no avail...
Reply
truefusion
Nov 19 2006, 07:17 PM
Here is the coding for mine: CODE <?php
header("Content-type: image/png");
$arr = array("random text", "random text", "random text", "random text", "random text", "random text", "random text" );
$string = $arr[array_rand($arr)];
$i = 10; $font = "../fonts/arial.ttf"; $size = imagettfbbox($i, 0, $font, $string); $width = ($size[2]+3) + ($size[0]+3); $height = abs($size[1]+3) + abs($size[7]+3); $im = @imagecreate($width, $height) or die("Cannot Initialize new GD image stream"); $bgcolor = imagecolorallocate($im, 238, 242, 247); $text_color = imagecolorallocate($im, 0, 0, 0); imagettftext($im, $i, 0, 2, abs($size[5]), $text_color, $font, $string); imagepng($im); imagedestroy($im);
?> It is also made to adjust the width and height to fit the text.
Reply
Rotator
Nov 20 2006, 06:13 AM
Thanks alot, guys! I finally got the look I was searching for. Had to tweak the code alot, but it works now... CODE <?php
header("Content-type: image/png");
$select = rand(1,3); if($select==1)$string1 = "Achievement Status"; if($select==1)$string2 = "4395 Gamerpoints"; if($select==2)$string1 = "Latest Game"; if($select==2)$string2 = "Gears of War"; if($select==3)$string1 = "Latest Achievement"; if($select==3)$string2 = "Veteran of D Day";
if($string1=="Achievement Status")$I1 = "65"; if($string2=="4395 Gamerpoints")$I2 = "74"; if($string1=="Latest Game")$I1 = "97"; if($string2=="Gears of War")$I2 = "87"; if($string1=="Latest Achievement")$I1 = "66"; if($string2=="Veteran of D Day")$I2 = "72";
$i = 14; $font = "lcd.ttf"; $size = imagettfbbox($i, 0, $font, $string); $im = @imagecreate(300, 80) or die("Cannot Initialize new GD image stream"); $bgcolor = imagecolorallocate($im, 0, 64, 0); $text_color = imagecolorallocate($im, 0, 255, 0); $text_color2 = imagecolorallocate($im, 0, 128, 0); imagettftext($im, $i, 0, 5, 20, $text_color2, $font, "88888888888888888888888888888"); imagettftext($im, $i, 0, 70, 20, $text_color, $font, "COLLECTION STATUS"); imagettftext($im, $i, 0, 5, 38, $text_color2, $font, "88888888888888888888888888888"); imagettftext($im, $i, 0, 39, 38, $text_color, $font, "48 RETAIL XBOX360 TITLES"); imagettftext($im, $i, 0, 5, 56, $text_color2, $font, "88888888888888888888888888888"); imagettftext($im, $i, 0, $I1, 56, $text_color, $font, $string1); imagettftext($im, $i, 0, 5, 74, $text_color2, $font, "88888888888888888888888888888"); imagettftext($im, $i, 0, $I2, 74, $text_color, $font, $string2); imagepng($im); imagedestroy($im);
?> Giving me that following image with the first two lines static and the other two random 
Reply
farsiscript
Nov 20 2006, 07:24 AM
Hi Dear Rotator i agree Rotator post , but dear Rotator i have one question about fonts and css . how we can use tff fonts in css files with out visitors download that fonts ?
Reply
Rotator
Nov 20 2006, 09:23 AM
QUOTE(farsiscript @ Nov 20 2006, 08:24 AM)  Hi Dear Rotator i agree Rotator post , but dear Rotator i have one question about fonts and css . how we can use tff fonts in css files with out visitors download that fonts ?
Well, I never worked with Cascading Style Sheets (CSS) before, so that would be a question for someone else  Sorry.
Reply
Rotator
Nov 20 2006, 08:43 PM
Okay, new question: With the current code, I have to manually changed the left indent of the text whenever I edit it, to make sure it's centered on the image... Isn't there a way to automatically ensure that the text is centered?
Reply
Similar Topics
Keywords : php, forum, signature
- Forum Script
(3)
Forum Last Post And Avatar
need little help here (5) hi guys. I have a little problem here. Im making my own version of forum, just got into this
problem on the last post from the topic and displaying the users avatar. i already have a upload
script but not for images. I tried making some experiments but it didnt work. maybe someone here
could help me. /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
just want to: 1.) query the last post. 2.)display the avatar of the user....
Creating A Login Box That Links To My Phpbb Forum
Have my phpBB Forum Intergrated with my Website (4) Can someone please give me a code that I can use to put a login box on my website, that will login a
user into my phpBB Forum? Sort of like Having my phpBB Forum Intergrated with my Website? Thank you
so much if you can! /angel.gif" style="vertical-align:middle" emoid=":angel:" border="0"
alt="angel.gif" /> Ex. ....
Forum Troubles
In phpbb (2) I am having forum trouble in phpbb. Whenever I go to post something or add someone to a group or
anything else, I get an error that looks like this: Could not find email template file ::
topic_notify DEBUG MODE Line : 111 File : emailer.php The email template thing changes but the
Line 111 and File emailer.php are always the same. It's getting really annoying. Can anyone
help me with this?....
How To Display The Latest Forum Post On Main Page
(4) Hey does anyone know how to display the latest forum post on the main page of a website? I'm new
to PHP and have no idea what to do. Thanks in advance!....
Forms, Text Files, And Php For A Signature Generator.
Help a little. (1) Hello everyone! I am in need of some code a for a signature generator I am making. I am using
BuffaloHELP's code for the php file, now I am trying to improve that code by making a form in a
html file that will have the user say what is on the sig! But now, I need help getting the form
data that is posted by the user to get into that sig! There is a file, sig.txt, where that tells
the php file what text will go on the sig. But how can I make the form data in the html file go into
the text file so it will go onto the sig? You might want to read BuffaloHELP&....
[forum] Double Posting Happening By An Error
(3) Hello, I am currently working on EvilBoard 0.1.1, for those who know about this project versjon 0.1b
can be downloaded from http://www.evilservices.com Well over to the reason why i am posting this,
I am currently experincing a problem with my new posting code wich has been rewrited in version
0.1.1, You see, it is double posting by an error, i thouht i could fix that myself, but no, so i
just thought, Trap17 is perfect, they problety know how to fix this, Here is the code: CODE
<? /* * @Name: Post Topic * @Author: Arne-Christian Blystad * @Copyright&....
Ipb Multi Forum (hosting Mod)
installation help? (6) Hi, i need a little help if possible, i have a multi forum hosting mod for ipb 1.31 ok.. I want to
install this but the install text included is a little unclear.. I already have a copy of ipb 1.31
installed and running (with users and posts), i want to install this mod but i also want to keep all
my db user/post info and still be able to use my existing forums with just a link to the forum
hosting form. Could someone please look at the documents included with this mod and give me more
clear instructions on how to do this? Do i need to install a second copy of the IPB UP....
Evilboard (forum Software) - Multiple Categorys - Don't Work :(
I am creating a forum and i can't fix more then 1 category. (6) I am at the moment trying to program my own forum, but i need more then a single category, here is
my source: CODE function cat () { include("functions/functions.php");
echo '<table width="100%" border="0" cellspacing="0">
<tr> <td class="eb_top" colspan="3" style="border-bottom-width:
0; height: 30px; font-size: 12px;"> <b>Forum</b></td>
</tr>'; global $catid; $db = new db; $db->connec....
Free Web Forum Scripts?
Question on web forum scripts (7) Can someone please tell me which of the free forum scripts is the best and why? I like these forums
but i notice the script is not free lol ;-)....
Do Somebody Have A Tutorial About... How To Create A Forum?
how to create a forum? (11) Hei, guys. Do somebodys here have a toturial about how to create a forum? I really do wanna
create my own forum, but I don't know exatly HOW! please, help me! Lucas ....
How I Can Display Forum Topic On Main Website ?
(4) Suppose i have a website.. domain.com , and have phpbb forums on domain.com/forums.. And i want to
display the new topics written in the forum on the main page of website...how i can do that.. ? for
example ,I want to display this topic `? "domain.com/forums/viewtopic.php?t=16" how can i do
that ?....
Phpskye The New Forum Software.
new forum software (4) PHPskye the upcomming forum software. Stefan Alkaline and I are making a new forum software with
some unique features. We currently are still working on the heavy coding. (that includes the layout
it sucks) But u are welcome to come and have a look. Remind feedback is allways welcome. We are
planning on distrubuting a free and a premium board. Some handy options will be available that no
board has so far. U are free to register and have a look around. U allso might notice the different
layouts the layout on the mainpage will be the layout the other will be deleted afte....
Dynamic Image / Signature Generator
a simple code to change text on an image (12) In search of dynamically changing quote, saying or all other types of text on an image I came across
a code that I have modified to fit my initial usage. This procedure requires two files and short
knowledge of PHP. If you are familiar with Trap17's sig rotation code you will understand this
procedure very fast. Code 1: dynamic_sig.php (you can rename this to index.php and you'll see
at the end why) Code 2: a simple text file named anything (I will call it name.txt ) Code 1
CODE <?php header("Content-type: image/png"); ....
Forum Signatures Help
(1) Click Here to view a post that i made to see whether my forum signature works in the signature
box, and it doesnt. I dont know why, it works in the message area yet not in the signature. What do
i need to do here in order to fix it? HTML is Enabled n i added the img into the HTML tags...still
doesnt work, please help.....
Can My Forum And Website Use The Same Profiles?
(3) I've been programming a 'rate-em' site from scratch. You know like Hot Or Not. YEs,..
yet another rate-em website. Anyway, i'ts done and before I launch it I need to add a forum as
the finishing touch, but all the forum softeware out there seems so hard to integrate. I'm
trying to make it so that when a user logs into my rate-em website they are also logged into 'my
forum'. i.e. i want my forum and web site to use the same profile data. If anyone knows of a
forum program made for this objective please let me know. I'm in over my head, a....
My Forum/shoutbox
its a shoutbox now, but will be a forum (8) Visit My Forum ok this is my forum it has: -Date Posted -Stores in mysql database -Shows in
Decending order -Able to use HTML (this is a bad thing) -Shows How many users are online -Shows how
long it takes to show the page -Looks simple and clean /smile.gif' border='0'
style='vertical-align:middle' alt='smile.gif' /> Will Add: -Member system -No HTML in Posts
-Replace the HTML with BB Codes if anyone could help me with the things i need to add please reply
and rate my script /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ill
releas....
Wap Forum
several questions on WAP forums (9) /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' /> Right i want to set up a
wap forum for rap battling. I think i need to use php, although i might need wml not sure. so
questions: 1) WML or PHP? 2) Can i get a forum/message board script? 3) Where can i get it? Thanks
in advance Not making helpful thread topics and titles results in warnings, or in extreme cases, a
ban. Don't fall into the crack. ....
Writing To Database Problem With Mysql - Not Writing Forum Post
(3) I'm making a forum and I've had several problems tonight which I've come here to ask
then found the answer to myself, but this one is stumping me. Whenever it goes to write the post to
the database, it saves the poster, and the time, but the part where the message would go is empty.
Here's the code, with comments about what it's supposed to do (what I wanted it to do and
thought it did): CODE $imsg = stripslashes($_POST['msg']);
//Get message if(strlen($imsg) > 5 && strlen($imsg)....
Myphp Forum
a simple yet powerful forum (12) I just tried installing a new forum a few days ago, called MyPHP Forum, I found it to be really
powerful yet, takes on the non-graphical approach, perhaps a link to my forum would be good, so you
can see what i mean, http://xeek.ca.tt/forum I'm partly doing this becasue I want people to
use te themes i made, /biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' />
check out the MyPHP website @ http://www.myphp.ws check out the user made themes @
http://myphp.ws/scripts.php ....
Help With Php Log-in Form
my PHP forum log-in form aint working (5) Ok .... I have this log-in form on my HomePage . It was designed with PHP scripting, but it aint
working. It simply doesnt respond to your log-in command. Can someone please help me with the exact
code to make it work? Here is the code for the log-in form... QUOTE
Forum Log-in
class=gen> Username:
Pass....
best forum boards to have
VOTE NOW (10) that a hard one to decribe which one is the best hmmm since i seen vbulletin alot longer then
anyother ones going with vb....
Looking for php, forum, signature
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for php, forum, signature
*MORE FROM TRAP17.COM*
|
advertisement
|
|