Ver Mensaje Individual
  #7 (permalink)  
Antiguo 15/11/2010, 06:08
Ghosty
 
Fecha de Ingreso: junio-2008
Mensajes: 292
Antigüedad: 15 años, 10 meses
Puntos: 4
Respuesta: guardar imaqen.php con .jpg

Perdona aki te dejo todo

Código PHP:
<?php
    
//If GD library is not installed, say sorry
    
if(!function_exists("imagecreate")) die("Sorry, you need GD library to run this example");
    
//Capture Post data
    
$data explode(","$_POST['img']);
    
$width $_POST['width'];
    
$height $_POST['height'];
    
$nombre $_POST ['nombre'];
    
//Allocate image
    
$image=(function_exists("imagecreatetruecolor"))?imagecreatetruecolor$width ,$height ):imagecreate$width ,$height );
    
imagefill($image000xFFFFFF);
    
//Copy pixels
    
$i 0;
    for(
$x=0$x<=$width$x++){
        for(
$y=0$y<=$height$y++){
            
$r hexdec("0x".substr$data[$i] , ));
            
$g hexdec("0x".substr$data[$i] , ));
            
$b hexdec("0x".substr$data[$i++] , ));
            
$color imagecolorallocate($image$r$g$b);
            
imagesetpixel ($image,$x,$y,$color);
        }
    }
    
    
//Output image and clean
    
header"Content-type: image/jpeg");
    
//header ("Location: mi_imagen.jpg");
    
ImageJPEG$image );
    
imagedestroy$image );    
    
$imageup file_get_contents($image);
    
file_put_contents("files_pedidos/micamiseta3.jpg"$imageup);
    
    
?>