Dynamic-Sig.com BETA Powered by:
September 10, 2010, 06:34:22 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Don't forget that you need to download our client program to be able to use your signature image. Click here to download the client program.
 
  Home   Forum   Help Search Login Register About Dynamic-Sig.com  
Pages: [1]
  Print  
Author Topic: Few questions about dynamic images  (Read 1700 times)
Achilleus
Newbie
*
Posts: 2


View Profile Email
« on: August 09, 2007, 06:09:55 AM »

I've been trying to make a dynamic signature image for my forum users, we've got the image and everything but it uses a non standard font.  How would I get the script to utilize it?

Code:
<?php

include_once("settings.php");

$bg "sigbg.png";
$im = @ImageCreateFromPNG($bg);

// white background and blue text
$textcolor imagecolorallocate($im255255255);

//mysql stuff to get member's username from request

mysql_connect($sitesettings['dbserver'], $sitesettings['dbuser'], $sitesettings['dbpw']);
mysql_select_db($sitesettings['dbname']);
$result mysql_query("SELECT * FROM smf_members WHERE ID_MEMBER = $_REQUEST[id]") or die(mysql_error());
mysql_close;

while(
$row mysql_fetch_array$result )) {
$name $row['realName'];
$posts $row['posts'];
$registered strftime("%D"$row['dateRegistered']);
$lastlogin strftime("%D"$row['lastLogin']);
}

mysql_free_result($result);

$font 3;

// write the string at the top left
imagestring($im$font551$name$textcolor);
imagestring($im$font5517$posts$textcolor);
imagestring($im$font11834$registered$textcolor);
imagestring($im$font9050$lastlogin$textcolor);

// output the image
header("Content-type: image/png");
header("font-family: Arial");
imagepng($im);
?>

That's roughly what I got now.  I don't remember if the header("font-family: Arial"); bit works.  I haven't messed with this in a long time but my users are asking for it again so I'm attempting to oblige them.
Logged
Daniel15
Owner of this site :D
Administrator
Jr. Member
*****
Posts: 96

208646779
View Profile WWW
« Reply #1 on: August 18, 2007, 04:32:55 PM »

The header wouldn't work.
You need to use the imagettftext function, and pass it the name of the .ttf file. So, if you wanted to use Arial, you'd upload arial.ttf to your server, and then use its full path.

See if my post at http://www.simplemachines.org/community/index.php?topic=173099.msg1105614#msg1105614 is helpful Smiley
Logged

Achilleus
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: August 29, 2007, 02:10:56 PM »

That's an excellent post, thank you.

How would I include the avatar on an image as well?  I was reading on php.net about all these image functions(NO clue how you can possibly know all this stuff haha) and there are so many that it's impossible to know which one to use Undecided  I tried using imagecopymerge() but no matter how I used it or where I put it in the script, it gave me an error Angry

I'd love to become as knowlegeable about these image functions as you are, do you have an advice or places I can go to learn them?  I hate having to keep asking people about this stuff.  I've found that php.net often has poor descriptions of the functions and how to use them Undecided
Logged
Daniel15
Owner of this site :D
Administrator
Jr. Member
*****
Posts: 96

208646779
View Profile WWW
« Reply #3 on: November 19, 2007, 05:37:52 PM »

I just learnt by playing around with it Tongue
I've never actually done what you're trying to do (overlay an image [the avatar] on another image). imagecopymerge should work, but I've not used it before.
Logged

halo2pac
Newbie
*
Posts: 1


View Profile Email
« Reply #4 on: February 10, 2008, 03:45:35 AM »

My code for a signature is very simular to that.. but when i use it in a forum it wont show up..
it is on my server in a folder called sig.png  . so when i use [img]  tags it just shows a [X]  but when u goto the link it shows the sig. why is that?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Dynamic-Sig.com version 0.6 ©2006–2007 Daniel15.
Valid XHTML 1.0! Valid CSS!
Page created in 0.033 seconds with 15 queries.