Log in

View Full Version : How to change the font of siggy.php ?


PokePets
08-14-2010, 09:15 AM
- How to change the font of your siggy images?
- How to center the text on the siggy images?

Thank you:rolleyes:

PokePets
08-18-2010, 03:51 AM
someone?

HIddenPanda
08-18-2010, 10:14 PM
LOL I was actually messing around with that today, It's actually very easy to do (even if you want to use your own font)

If you look at mine, (from pixelpets.co.cc :D) I set mine to use a font i downloaded for my recent obsession (Simlish from The Sims game series)

1. Find a font (I've had luck with Google and dafont.com)

2. You will most likely have to convert the font to a .gdf file so I reccomend http://www.wedwick.com/wftopf.exe if its a TrueType font.

3. Upload the font to the fonts folder on your server.

4. Open up siggy.php and look for the following lines (around Line 170)

$str1 = "Name: ".$name;
$str2 = "Owner: ".$owner;
$str3 = "Train Me!";
$str4 = "More Adopts at:";
$str5 = $domain;

imagestring ($image, 12, 0, $textheight, $str1, $color);
imagestring ($image, 12, 0, $textheight + 13, $str2, $color);
imagestring ($image, 12, 0, $textheight + 26, $str3, $color);

Yours is probably different because I have edited mine a bit

5. Insert the following code (with obvious modifications BEFORE the imagestring() lines
$font = imageloadfont('fonts/GDF FILE NAME HERE!!!!!.gdf');

That tells the page to load the font for usage

6. Change the 2nd variable in the imagestring lines you want this font to be used (in this case replace the 12s)

In the end it should look somewhat similar to this

$str1 = "Name: ".$name;
$str2 = "Owner: ".$owner;
$str3 = "Train Me!";
$str4 = "More Adopts at:";
$str5 = $domain;
$str6 = "LOL Simlish";

$font = imageloadfont('fonts/sims.gdf');
imagestring ($image, $font, 0, $textheight, $str1, $color);
imagestring ($image, $font, 0, $textheight + 13, $str2, $color);
imagestring ($image, $font, 0, $textheight + 26, $str3, $color);
imagestring ($image, 12, 0, $textheight + 43, $str6, $color);


Sorry that this tutorial is kinda crappy im a bit tired at the moment

PokePets
08-19-2010, 03:11 AM
Thank you :D !
PS; I play the sims to :p

PokePets
08-19-2010, 04:43 AM
It works thank you :D!

fadillzzz
08-19-2010, 09:10 AM
LOL I was actually messing around with that today, It's actually very easy to do (even if you want to use your own font)

If you look at mine, (from pixelpets.co.cc :D) I set mine to use a font i downloaded for my recent obsession (Simlish from The Sims game series)

1. Find a font (I've had luck with Google and dafont.com)

2. You will most likely have to convert the font to a .gdf file so I reccomend http://www.wedwick.com/wftopf.exe if its a TrueType font.

3. Upload the font to the fonts folder on your server.

4. Open up siggy.php and look for the following lines (around Line 170)

$str1 = "Name: ".$name;
$str2 = "Owner: ".$owner;
$str3 = "Train Me!";
$str4 = "More Adopts at:";
$str5 = $domain;

imagestring ($image, 12, 0, $textheight, $str1, $color);
imagestring ($image, 12, 0, $textheight + 13, $str2, $color);
imagestring ($image, 12, 0, $textheight + 26, $str3, $color);

Yours is probably different because I have edited mine a bit

5. Insert the following code (with obvious modifications BEFORE the imagestring() lines
$font = imageloadfont('fonts/GDF FILE NAME HERE!!!!!.gdf');

That tells the page to load the font for usage

6. Change the 2nd variable in the imagestring lines you want this font to be used (in this case replace the 12s)

In the end it should look somewhat similar to this

$str1 = "Name: ".$name;
$str2 = "Owner: ".$owner;
$str3 = "Train Me!";
$str4 = "More Adopts at:";
$str5 = $domain;
$str6 = "LOL Simlish";

$font = imageloadfont('fonts/sims.gdf');
imagestring ($image, $font, 0, $textheight, $str1, $color);
imagestring ($image, $font, 0, $textheight + 13, $str2, $color);
imagestring ($image, $font, 0, $textheight + 26, $str3, $color);
imagestring ($image, 12, 0, $textheight + 43, $str6, $color);


Sorry that this tutorial is kinda crappy im a bit tired at the moment


You can also use imagettftext instead so that you can use .ttf and get better looking text since .gdf doesn't have anti aliasing

http://www.adoptapoke.com/siggy.php?id=455 (http://www.adoptapoke.com/levelup.php?id=455)

PokePets
08-19-2010, 09:31 AM
& how can i center the tekst?

fadillzzz
08-19-2010, 12:13 PM
I can't guarantee you that this is going to work for your site but I hope this can be your solution even if it's just temporary

before
imagestring ($image, 12, 0, $textheight, $str1, $color);
imagestring ($image, 12, 0, $textheight + 13, $str2, $color);
imagestring ($image, 12, 0, $textheight + 26, $str3, $color);
imagestring ($image, 12, 0, $textheight + 42, $str4, $color);
imagestring ($image, 12, 0, $textheight + 55, $str5, $color);

Add this line

$x = ($newwidth - $newwidth/2)/2;

And then replace the zeros from

imagestring ($image, 12, 0, $textheight, $str1, $color);
imagestring ($image, 12, 0, $textheight + 13, $str2, $color);
imagestring ($image, 12, 0, $textheight + 26, $str3, $color);
imagestring ($image, 12, 0, $textheight + 42, $str4, $color);
imagestring ($image, 12, 0, $textheight + 55, $str5, $color);

to $x

Final code should looks like this

$x = ($newwidth - $newwidth/2)/2;

imagestring ($image, 12, $x, $textheight, $str1, $color);
imagestring ($image, 12, $x, $textheight + 13, $str2, $color);
imagestring ($image, 12, $x, $textheight + 26, $str3, $color);
imagestring ($image, 12, $x, $textheight + 42, $str4, $color);
imagestring ($image, 12, $x, $textheight + 55, $str5, $color);

PokePets
08-21-2010, 03:42 AM
fadillzzz,
You mean i must change
$font = imageloadfont('fonts/example.gdf');
to
$font = imagettftext('fonts/example.ttf');
?
& for your center code :s, i get this;
http://www.secret.uphero.com/adoptables/siggy.php?id=2

the text goes "out" the image :S,

already thanks,
Niels ;)

fadillzzz
08-21-2010, 05:01 AM
No, you don't need the imageloadfont to use imagettftext
read this
http://php.net/manual/en/function.imagettftext.php
and compare it to
http://php.net/manual/en/function.imagestring.php

imageloadfont is needed only if you want to use imagestring with custom font

take a look at my code

$str1 = "".$name;
$str2 = "Level:".$level;
$str3 = "".$domain;
$font = 'path/to/your/font.ttf';
$black = imagecolorallocate($image, 20, 20, 20);

imagettftext ($image, 16, 0, 0, $textheight + 18, $black, $font, $str1);
imagettftext ($image, 16, 0, 0, $textheight + 34, $black, $font, $str2);
imagettftext ($image, 16, 0, 0, $textheight + 50, $black, $font, $str3);


you can leave the '$image' untouch, and the number '16' is the font size, the first '0' is the angle, the second '0' is the x coordinates, the '$textheight ...' is the y coordinate, '$black' represent the font color, and '$font' is the font itself and last but not least '$str*' is the text to be loaded

Don't forget to define the variable like '$black' and '$font' before the imagettftext

Also, if you are still wondering how to center the text (using imagestring), read this
http://www.php.net/manual/en/function.imagestring.php#94306

bruce678
08-23-2010, 01:39 AM
No, you don't need the imageloadfont to use imagettftext
read this
http://php.net/manual/en/function.imagettftext.php
and compare it to
http://php.net/manual/en/function.imagestring.php

imageloadfont is needed only if you want to use imagestring with custom font

take a look at my code

$str1 = "".$name;
$str2 = "Level:".$level;
$str3 = "".$domain;
$font = 'path/to/your/font.ttf';
$black = imagecolorallocate($image, 20, 20, 20);

imagettftext ($image, 16, 0, 0, $textheight + 18, $black, $font, $str1);
imagettftext ($image, 16, 0, 0, $textheight + 34, $black, $font, $str2);
imagettftext ($image, 16, 0, 0, $textheight + 50, $black, $font, $str3);


you can leave the '$image' untouch, and the number '16' is the font size, the first '0' is the angle, the second '0' is the x coordinates, the '$textheight ...' is the y coordinate, '$black' represent the font color, and '$font' is the font itself and last but not least '$str*' is the text to be loaded

Don't forget to define the variable like '$black' and '$font' before the imagettftext

Also, if you are still wondering how to center the text (using imagestring), read this
http://www.php.net/manual/en/function.imagestring.php#94306

doaine2
09-02-2010, 01:13 AM
Alls well ?

jillyronald
09-22-2010, 02:34 AM
Settings > user control panel > font style > change font > select the font which style you want. Then select ok from this way you can change the font of siggy.php. You also change font colour, size, style, and also you can add any extra fonts.