Pensamientos al azar acerca de vBSEO y bmwfaq.com
Forum Stats Signature Generator
Escrito 21/11/07 a las 09:50 por Danny
I make a stupid script to generate forum stats in a image template with GD. This is based in a old plugin that come from the earling times of vBulletin2
What make this
Based in a template image

The script that is executed a scheduled task from the vB adminCP modify the template and put in it your forum stats.

You can modify this script for you own pourposes
Install Instructions
Note: I test this in windows enviroment, i think in linux you need change the variable $Top=22 by $Top=10
The Code
What make this
Based in a template image

The script that is executed a scheduled task from the vB adminCP modify the template and put in it your forum stats.

You can modify this script for you own pourposes
Install Instructions
- Upload the script signature.php to forum-root/includes/cron
- Create a directory called signature in forum-root/images and make wright right (chmod 777 or chown apache:apache) and upload the image sig.jpg (modify as you want to have your own base image)
- Go to vB AdminCP->Scheduled Tasks->Add new Task
- Task Name: Signature Generator
- Includes: ./includes/cron/signature.php
- Time choose what you want, mine is setter to be executed every 3 hours
Note: I test this in windows enviroment, i think in linux you need change the variable $Top=22 by $Top=10
The Code
Código PHP:
[left]<?php
/* Author: Danny Bembibre
* A PHP script to generate dynamic signature with your forum stats
* Put the file as a Task in the vBulletin Cron
* Based in old vbulletin hack
* http://www.vbulletin.org/forum/showthread.php?t=50848
*/[/left]
[left]error_reporting(E_ALL & ~E_NOTICE);[/left]
[left]if (!is_object($vbulletin->db)){
exit;
}[/left]
[left]//*************************
//Configure Image Variables
$TotalHeight=60;
$TotalWidth=260;
$LineSpacing=15;
$Top=22;
$Left=153;
//*************************[/left]
[left]$TotalPosts = $vbulletin->db->query_first("SELECT COUNT(postid) AS posts FROM " . TABLE_PREFIX . "post");
$TotalPosts = number_format($TotalPosts['posts']); [/left]
[left]$TotalThreads = $vbulletin->db->query_first("SELECT COUNT(threadid) AS threads FROM " . TABLE_PREFIX . "thread");
$TotalThreads = number_format($TotalThreads['threads']); [/left]
[left]$TotalUsuarios = $vbulletin->db->query_first("SELECT COUNT(userid) AS usuarios FROM " . TABLE_PREFIX . "user");
$TotalUsuarios = number_format($TotalUsuarios['usuarios']); [/left]
[left]$ImgBase = ImageCreateTrueColor($TotalWidth,$TotalHeight);[/left]
[left]$Text = "Members:" . $TotalUsuarios . "nThreads:" . $TotalThreads . "nPosts:" . $TotalPosts . "n";[/left]
[left]$BGcolor = ImageColorAllocate ($ImgBase, 255, 255, 255);
$TextColor = ImageColorAllocate ($ImgBase, 0, 0, 0);
ImageFilledRectangle ($ImgBase, 0, 0, $TotalWidth, $TotalHeight, $BGcolor);
ImageCopy ($ImgBase, @ImageCreateFromJPEG(DIR . "/Images/signature/sig.jpg"), 0, 0, 0, 0, $TotalWidth, $TotalHeight);
ImageColorTransparent($ImgBase, $BGcolor); [/left]
[left]$SplitedText = split("n", $Text);
$Idx = 0;
while($Idx < Count($SplitedText)){
ImageString($ImgBase, 2, $Left, (($Idx * $LineSpacing) - $LineSpacing + $Top), $SplitedText[$Idx], $TextColor);
$Idx++; }[/left]
[left]@ImageJPEG($ImgBase, DIR . "/Images/signature/siggenerated.jpg", 95); //Escribir la imagen al disco
@ImageDestroy($ImgBase); //Limpiar la memoria[/left]
[left]//log_cron_action('Signature Stats Generator', $nextitem);[/left]
?> Total de Comentarios 0
Comentarios
Entradas Recientes por Danny
- Carroll Shellby (Las Vegas) |Vivid Racing (Phoenix) | Universal Park y Museo (L.A) (23/09/08)
- Spanish translation of LinkBacks (22/11/07)
- Forum Stats Signature Generator (21/11/07)
- Daemon scripts for memcached (20/11/07)
- Enable caching functions get and put in eAccelerator (20/11/07)




