Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/10/2013, 09:18
urieldc777
 
Fecha de Ingreso: septiembre-2011
Mensajes: 17
Antigüedad: 15 años, 1 mes
Puntos: 0
Exclamación recortar imagen con php

buenos días a todos.

Tengo un problemita y ya he buscado por todas partes pero no me doy cuenta de como hacerlo.

Tengo una imagen y la quiero redimensionar pero no hay manera, el código no da fallos pero la imagen no la guarda en ningún sitio ni recortar nada. el código es el siguiente:

Código PHP:
$filename= "imagen.jpg"
$src_im = $filename;
list(
$w, $h, $type, $attr) = getimagesize($filename); 
$src_im = imagecreatefromjpeg($filename); 

$src_x = $_POST['x1'];   // comienza x 
$src_y = $_POST['y1'];   // comienza y 
$src_w = $_POST['w']; // ancho 
$src_h = $_POST['h']; // alto 
$dst_x = $_POST['x2'];   // termina x 
$dst_y = $_POST['y2'];   // termina y 

$dst_im = imagecreatetruecolor($src_w, $src_h); 
$white = imagecolorallocate($dst_im, 255, 255, 255); 
imagefill($dst_im, 0, 0, $white); 

imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); 

header("Content-type: image/png"); 
imagepng($dst_im); 
imagedestroy($src_im); 
A ver pueden encontrar el fallo o me pueden ayudar, ya estoy muy mareado con el tema.