hi, im trying to load an image, with the gd commands and it works: something like this:
imagen.php:
<?php
$im = ImageCreateFromPng("../images/urug3_1.png");
$rojo = ImageColorAllocate($im, 255, 0, 0);
$diam=8;
while ($diam > 0){
Imagearc($im, imagesx($im)/4, imagesy($im)/10, $diam, $diam, 0, 360, $rojo);
$diam--;
}
ImagePng($im);
ImageDestroy($im);
?>
but when i try to do that from a class, it doesnt put the image on the browser, the php put some strange caracters:
clases.php:
<?
class Mapa {
var $im ;
function Mapa(){ $this->im = ImageCreateFromPng("../images/urug3_1.png"); }//constructor
function pintar_rbs($x , $y , $estado){
switch ($estado) {
case 0:
$color = ImageColorAllocate($this->im, 0, 255, 0); //verde
break;
case 1:
$color = ImageColorAllocate($this->im, 100, 100, ); //amarillo
break;
case 2:
$color = ImageColorAllocate($this->im, 255, 0, 0); //rojo
break;
}
$diam=8;
while ($diam > 0){
Imagearc($this->im , $x, $y, $diam, $diam, 0, 360, $color);
$diam--;
}
ImagePng($this->im);
ImageDestroy($this->im);
}//pintar_rbs
}//clase
?>
im_clas.php:
<?php
include("clases.php");
$m = new Mapa;
$m->pintar_rbs(50 , 50 , 1);
?>
//when i run im_clas.php it dont make any error but some strange caracters are shown instead of my png image.
what can i do??
thanks
byp