This is a discussion on How to create dynamic signiture images? within the Programming Articles forums, part of the Webmaster Articles/Tutorials category; NOTE:I have only tryed this script on phpBB forums, and i do not know if it works on any other ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| | #1 (permalink) |
| Moderator | NOTE:I have only tryed this script on phpBB forums, and i do not know if it works on any other forums. In this tutorial i will teach you how to make a simple dymanic signiture using php. This contains a total of 4 files will be needed for this. There will be a .php files, a .jpeg.php file, and a .htaccess file. and a simple .jpeg image. The the .htaccess file put the following: Code: Options Indexes FollowSymLinks MultiViews All RewriteEngine on RewriteBase / RewriteRule (.+)/image.jpeg image.jpeg?forum=$1 The next part you will have to save as image.jpeg.php, which basically gets information from the last part of the tutorial Code: <?
$forum=$_GET['forum'];
$user=$_GET['user'];
$url=str_replace('que','?',$forum);
$url=str_replace('and','&',$url);
$url=str_replace('equ','=',$url);
$url=str_replace('dot','.',$url);
$url=str_replace('pre','http://',$url);
$lines = file($url);
$content = "";
foreach ($lines as $line) {
$content .= $line;
}
$pattern='|<td valign="top"><b><span class="gen">([0-9]+)</span></b><br /><span class="genmed">.+ of total|';
preg_match("$pattern","$content", $matches);
$matches[1] .= " Posts";
Header("Content-Type: image/gif");
$myimage = ImageCreateFromGif("siggy3.gif");
$black = ImageColorAllocate($myimage, 0, 0, 0);
$width = ((imagesx($myimage)-7.5*strlen($matches[1]))/2)-6;
ImageString($myimage, 5, $width, 44, $matches[1], $black);
ImageGif($myimage);
ImageDestroy($myimage);
?>
![]() The next part needs some small editing, just change line 2 to the website that the code is on, the code must be in the top directory. Then save the below as numposts.php Code: <?
$website="http://www.site.com";
$forum=$_POST['forum'];
$user=$_POST['user'];
if ($forum){
$url=str_replace('?','que',$forum);
$url=str_replace('&','and',$url);
$url=str_replace('=','equ',$url);
$url=str_replace('.','dot',$url);
$url=str_replace('http://','pre',$url);
echo "<img src=$website/$url/image.jpeg><br>";
echo "$website/$url/image.jpeg";
}else{
?>
<form action=numposts.php method=post>
URL of profile.php: <input type=text name=forum><br>
<input type=submit value=Submit>
</form><br><br>
<b>Example</b><br>
URL of profile.php: http://www.site.com/forum/profile.php?mode=viewprofile&u=4818<br>
<?
}
?>
__________________ Free .org domain - Click for details! Do not pm asking for things. My inbox is full. Add me to MSN! |
| | |
| | #3 (permalink) |
| Moderator | I made it, but my php skills are not very good, so that there may be a script error.
__________________ Free .org domain - Click for details! Do not pm asking for things. My inbox is full. Add me to MSN! |
| | |
| Tags |
| create, dynamic, images, signiture |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What shall i create with angelfire-am.org | robertall | Website Development Forum | 9 | 10-10-2005 06:54 |
| Static / dynamic???? | benf | Programming / Scripting / Coding | 4 | 09-06-2005 13:39 |
| I need to create a blog. Please suggest | godofdomains | General Webmaster Discussion | 7 | 30-05-2005 14:16 |
| SOTM (signiture of the month). | robertall | General Webmaster Discussion | 0 | 18-04-2005 19:30 |
| Dynamic URLS | mck9235 | Programming Articles | 4 | 15-04-2005 02:08 |