Free Web Hosting Forum
(#1 (permalink))
Old
Senior Member
Sogo7 is on a distinguished road
 
Posts: 238
Join Date: Dec 2010
Default Dynamic Signature Tags - 02-26-2011, 03:22 AM

Somebody asked the other day how they could take the hassle out of changing their signature tag automatically for a forum so that they could show off more of thier artwork to passing readers.



Using the GD library functions for PHP allows you create images from scratch or add text to existing ones. The example above is drawn using this process with the content being provided by an RSS feed but could just as easy be the viewers IP address or your twitter feed for instance.

You could use other variables to choose what image is displayed such as local time, referer, IP address, browser type, screen size etc. Here's a quick code snippet. Or you can see the live code in action here http://bishop.comxa.com/e6_epsilon/index.php

PHP Code:
$newtext ="text to go on image";


header("Content-type: image/png");/// setup output image type jpg,gif,png
$im     imagecreatefrompng("base.png"); //get background image

// setup text colour using RGB values
$black imagecolorallocate($im0x000x000x00);


// Path to  ttf font file
$font_file 'tahoma.ttf';

// make text jump to newline if longer 40 characters
$newtext wordwrap($headline40"\n");


// Draw the text  
$fontSize 14 // size of text
$rotation // rotate text
$Xpos 25 // x position start text
$Ypos 25 // y position  ,,  ,,

imagefttext($im$fontSize$rotation$Xpos$Ypos$black$font_file$newtext);

// Output image 

imagepng($im);  /// display 

//or Save the image as 
//imagepng($im, 'sig.png');  /// saving image makes page display fail


imagedestroy($im);//// tidying up variables for next visitor 


Reply With Quote
Sponsored Links
(#2 (permalink))
Old
grozenyku's Avatar
Junior Member
grozenyku is on a distinguished road
 
Posts: 15
Join Date: Jul 2010
Default 09-24-2011, 03:00 PM

hello i have this problem:
Quote:
//imagepng($im, 'sig.png'); /// saving image makes page display fail
after i save the image i get that error that the picture could not be displayed because it contains errors but the work i need this script to do it does
the problem is that after this code i have this code
Quote:
echo "<body onload=\"window.location='backend/index.php'\">";
and this code does not work. I need the user redirected after processing the picture to the index page, how can i do that.

Thank you in advance for replying.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com