Tema: subir fotos
Ver Mensaje Individual
  #9 (permalink)  
Antiguo 04/08/2004, 08:17
Avatar de ignacio_giri
ignacio_giri
 
Fecha de Ingreso: febrero-2003
Ubicación: Argentina, Rosario
Mensajes: 585
Antigüedad: 21 años, 1 mes
Puntos: 0
en la pagina que tengas de conexion a la bd pone esta function

function ResizeImageboliche($im,$maxwidth,$maxheight,$name) {
$width = imagesx($im);
$height = imagesy($im);
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight)){
if($maxwidth && $width > $maxwidth){
$widthratio = $maxwidth/$width;
$RESIZEWIDTH=true;
}
if($maxheight && $height > $maxheight){
$heightratio = $maxheight/$height;
$RESIZEHEIGHT=true;
}
if($RESIZEWIDTH && $RESIZEHEIGHT){
if($widthratio < $heightratio){
$ratio = $widthratio;
}else{
$ratio = $heightratio;
}
}elseif($RESIZEWIDTH){
$ratio = $widthratio;
}elseif($RESIZEHEIGHT){
$ratio = $heightratio;
}
$newwidth = $width * $ratio;
$newheight = $height * $ratio;
if(function_exists("imagecopyresampled")){
$newim = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}else{
$newim = imagecreate($newwidth, $newheight);
imagecopyresized($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}
ImageJpeg ($newim,"../fotosboliche/$name" . ".jpg");
ImageDestroy ($newim);
}else{
ImageJpeg ($im,"../fotosboliche/$name" . ".jpg");
}
}
__________________
Ignacio