Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/12/2007, 13:51
Capi666
 
Fecha de Ingreso: febrero-2007
Ubicación: Valencia
Mensajes: 457
Antigüedad: 17 años, 2 meses
Puntos: 0
Re: Modificar una foto en una web...

Bueno, he avanzado bastante, os enseño lo que tengo y mis problemas:

Código:
<?
if ($_POST["x"] <> NULL) {
header("Content-type: image/jpeg");

// Creamos las dos imágenes a utilizar 
$imagen1 = imagecreatefromjpeg("imagen.jpg");
$imagen2 = imagecreatefromjpeg("x.jpg");

// Copiamos una de las imágenes sobre la otra 
imagecopy($imagen1,$imagen2,$_POST["x"],$_POST["y"],0,0,137,84);

// Damos salida a la imagen final 
imagejpeg($imagen1);

// Destruimos ambas imágenes
imagedestroy($imagen2);
imagedestroy($imagen1);
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin t&iacute;tulo</title>
<script type="text/javascript"> 
<!-- inicio 
var IE = document.all?true:false 
if (!IE) document.captureEvents(Event.MOUSEMOVE) 

document.onmousemove = posicRatonXY; 
var posicX = 0 
var posicY = 0 

function posicRatonXY(e) { 
if (IE) { posicX = event.clientX + document.body.scrollLeft; 
posicY = event.clientY + document.body.scrollTop} 
else { posicX = e.pageX; posicY = e.pageY }; 
if (posicX < 0) {posicX = 0}; 
if (posicY < 0) {posicY = 0}; 

document.getElementById("Raton").x.value = posicX; 
document.getElementById("Raton").y.value = posicY; 
return true } 
// final --> 

function obtenerPos(event)
{
if(document.all)
diferencia=2;
else
diferencia=0; 
x=event.clientX-document.visor.offsetLeft-diferencia;
y=event.clientY-document.visor.offsetTop-diferencia;

document.Raton.submit();

}
</script> 
</head>

<body>
<img name="visor" src="imagen.jpg" onClick="obtenerPos(event)">

<div style="text-align:center"> 
<form id="Raton" name="Raton" action="" method="post"> 

<input type="hidden" id="x" name="x" value="0" size="4" style="text-align:right"> 

<input type="hidden" id="y" name="y" value="0" size="4" style="text-align:right">

<input type="submit">

</form> 
</div> 

</body>
</html>
Ok, vale, me sale todo correcto, me sale la nueva imagen superpuesta con la otra imagen donde yo le he dicho, pero... ¿como la puedo guardar?

Y otra cosa mas dificil, ¿como podria marcar varios sitios?

Gracias,