Vale, quitando el header me funciona, pero tengo otro problemilla :(
Lo he pasado a php5 (POO) y me saca la imagen en negro
Código PHP:
<?php
class resize_new_image {
private $image_name;
private $image_new_name;
private $image_width_maxsize;
private $image_height_maxsize;
public function __construct($image_name,$image_new_name,$image_width_maxsize,$image_height_maxsize) {
$this->image_name=$image_name;
$this->image_new_name=$image_new_name;
$this->image_width_maxsize=$image_width_maxsize;
$this->image_height_maxsize=$image_height_maxsize;
}
public function resize_image() {
//get original picture info
list($ancho_orig, $alto_orig) = getimagesize($this->image_name);
$ratio_orig = $ancho_orig/$alto_orig;
if ($this->image_width_maxsize/$this->image_height_maxsize > $ratio_orig) {
$this->image_width_maxsize = $this->image_height_maxsize *$ratio_orig;
}
else {
$this->image_height_maxsize = $this->image_width_maxsize/$ratio_orig;
}
//resize image
$image_p = imagecreatetruecolor($this->image_height_maxsize, $this->image_height_maxsize);
$image = imagecreatefromjpeg($this->image_new_name);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $this->image_height_maxsize, $this->image_height_maxsize, $ancho_orig, $alto_orig);
echo $alto_orig;
//create new image
imagejpeg($image_p, $this->image_new_name, 100);
echo "<img src='{$this->image_new_name}'>";
}
}
$minipic = new resize_new_image("mikel.jpg","mini_mikel2.jpg",100,100);
$minipic->resize_image();
?>
sabéis a que se debe?