![apachar ojo](http://static.forosdelweb.com/fdwtheme/images/smilies/wink.png)
Este es el código que creo que falla (para php 5.x porque para php 4.x sí funciona bien). YA ME HA PASADO ANTES TENER QUE MODIFICAR ALGO EN EL CÓDIGO PARA ADAPTARLO A PHP 5.X (por ejemplo alguna variable que debe pasarse por referencia,...,etc)
mod_graphical_counter_generate.php
Código PHP:
<?php
header("Content-type: image/png");
$font_set = "ERASBD.TTF";
$font_size = 25;
$var_text = $_GET['n'];
$text_color = hex2dec("#EEC56E");
$bg_color = hex2dec("#F5F5F6");
$BOX = imagettfbbox($font_size, 0, $font_set, $var_text);
$i_width = $BOX[4]+5;
$i_height = -$BOX[5];
$im = imagecreate($i_width,$i_height);
$white = imagecolorallocate($im,$bg_color['r'],$bg_color['g'],$bg_color['b']);
$textcolor = imagecolorallocate($im,$text_color['r'],$text_color['g'],$text_color['b']);
imagettftext($im, $font_size,0,0,$i_height, $textcolor,$font_set,$var_text);
imagepng($im);
imagedestroy($im);
function hex2dec($hex) {
$color = str_replace('#', '', $hex);
$ret = array(
'r' => hexdec(substr($color, 0, 2)),
'g' => hexdec(substr($color, 2, 2)),
'b' => hexdec(substr($color, 4, 2))
);
return $ret;
}
?>
mod_graphical_counter.php
Código PHP:
<?php
/// $Id: mod_graphical_counter.php, v1.0 2004/11/09 20:56:34 Vrajesh Exp $
/**
* Graphical Visitors Counter
* @ package Mambo Open Source
* @ Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @ Author : Vrajesh - www.pixelthemes.com
* @ version $Revision: 1.0 $
**/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$content = "";
// *** Geting params
//$i = $params->get( 'i_from_xml' );
$increase =1;
$query = "SELECT sum(hits) AS count FROM #__stats_agents WHERE type='1'";
$database->setQuery( $query );
$hits = $database->loadResult();
$hits = $hits + $increase;
if ($hits == NULL)
{
$content .= "<div align='center'><img src='$mosConfig_live_site/modules/mod_graphical_counter_generate.php?n=0' border='0'></div>";
}
else
{
$content .= "<div align='center'><img src='$mosConfig_live_site/modules/mod_graphical_counter_generate.php?n=$hits' border='0'></div>";
}
?>
Espero vuestra ayuda
Saludos cordiales
Daniel