buneas, si bien programo en php, y siempre usé clases, nunca hice una yme gustaria poder pasar una funcion que tengo a una clase. pero por ahi me pierdo
aca pongo la funcion.
Código PHP:
function resize($tmp_name, $original_name, $new_name, $width, $height, $folder) {
$img_info = getimagesize($tmp_name);
$new_name .= getImageExtension($original_name);
if(IMG_HANDLER == "GD"){
$full_name = PATH . $folder . $new_name;
//echo $full_name."<br>";
if ($img_info[0] <= $width AND $img_info[1] <= $height) {
copy($tmp_name, $full_name);
}else{
resize_image($tmp_name, $original_name, $full_name, $width, $height, $scale, true, 85);
}
chmod($full_name, 0644);
}else if(IMG_HANDLER == "ImageMagick"){
if ($img_info[0] <= $width AND $img_info[1] <= $height) {
copy($tmp_name, PATH . $folder . $new_name);
}else{
system(CONVERT . "convert -quality 80 -density 80 " . $tmp_name . " -resize " . $width . "x" . $height . " " . PATH . $folder . $new_name);
}
}
}
salu2 y gracias