200x136
Lo curioso es que si lo hago como está en el primer post, me lo redimensiona bien, pero si hago:
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;
$cuanto = $this->image_width_maxsize/$this->image_height_maxsize;
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_name);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $this->image_width_maxsize, $this->image_height_maxsize, $ancho_orig, $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_mikel.jpg",100,100);
$minipic->resize_image();
$medpic = new resize_new_image("mikel.jpg","med_mikel.jpg",64,64);
$medpic->resize_image();
$iconpic = new resize_new_image("mikel.jpg","icon_mikel.jpg",32,32);
$iconpic->resize_image();
?>
me lo hace con las proporciones que te comento en el anterior post :(