Ver Mensaje Individual
  #5 (permalink)  
Antiguo 12/08/2010, 09:36
IEKK
 
Fecha de Ingreso: agosto-2010
Ubicación: Tenerife
Mensajes: 893
Antigüedad: 13 años, 8 meses
Puntos: 202
Respuesta: Como realizar este trabajo

Disculpa por poner el style en el div pero así lo escribía rapido.

Se podría hasta usar un div o hacer el mismo método sólo con una imagen pero me vino así a la mente, ya mejoras tu el ejemplo.

Espero que te sirva.

Código PHP:
<?php
$imagen 
"http://www.deathknell.cc/images/bargraph.gif";
$usuarios 100;
$maximo600;
$porcentaje = ($usuarios 100) / $maximo// regla de tres

if($maximo >= $usuarios){
echo 
'<div style="height:25px; width:'.ceil($maximo/3).'px; float:left; position:absolute; background:#CCC;">';
    
    echo 
'<div style="height:25px; width:'.$porcentaje.'%; float:left; position:relative; background:url('.$imagen.');"></div>';
echo 
'</div>';
}
?>
Un saludo.

Última edición por IEKK; 12/08/2010 a las 10:26