Foros del Web » Programando para Internet » PHP »

problema redimencionador de imagenes

Estas en el tema de problema redimencionador de imagenes en el foro de PHP en Foros del Web. holas gente, vamos al grano, tengo un redimencionador de imagenes en php, y funcionaba bien hasta que se me ocurrio ponerle una imagen mas pequeña ...
  #1 (permalink)  
Antiguo 06/07/2009, 01:09
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
problema redimencionador de imagenes

holas gente, vamos al grano, tengo un redimencionador de imagenes en php, y funcionaba bien hasta que se me ocurrio ponerle una imagen mas pequeña y me la estira :/, les explico, por ejemplo tengo una

imagen 1 de 1024x768px y una
imagen 2 de 300x300px

entonces a este redimencionador le digo que el maximo sea de 500*500 y con la imagen 1 trabaja bien me la achica segun lo que necesita, pero con la 2 me la estira para lograr los 500x500 cuando no deberia hacer nada con esa imagen :/ entonces si pongo una imagen mas pequeña de 50x50 me la pixela demaciado lelvandola a 500x500 alguna solucion para que actue cuando la imagen es mayor de lo que se quiere redimencionar?

Código php:
Ver original
  1. <?php
  2. $anchura= $_GET['ancho'];
  3. $hmax= $_GET['alto'];
  4. $nombre=$_GET['archivo'];
  5. $datos = getimagesize($nombre);
  6. if($datos[2]==1){$img = @imagecreatefromgif($nombre);}
  7. if($datos[2]==2){$img = @imagecreatefromjpeg($nombre);}
  8. if($datos[2]==3){$img = @imagecreatefrompng($nombre);}
  9. $ratio = ($datos[0] / $anchura);
  10. $altura = ($datos[1] / $ratio);
  11. if($altura>$hmax){$anchura2=$hmax*$anchura/$altura;$altura=$hmax;$anchura=$anchura2;}
  12. $thumb = imagecreatetruecolor($anchura,$altura);
  13. imagecopyresampled($thumb, $img, 0, 0, 0, 0, $anchura, $altura, $datos[0], $datos[1]);
  14. if($datos[2]==1){header("Content-type: image/gif"); imagegif($thumb);}
  15. if($datos[2]==2){header("Content-type: image/jpeg");imagejpeg($thumb);}
  16. if($datos[2]==3){header("Content-type: image/png");imagepng($thumb); }
  17. imagedestroy($thumb);
  18. ?>

para redimencionar hago

Código HTML:
<img src="redimencionador.php?archivo=foto&alto=500&ancho=500"   border="0"  alt="Ver" title="Click para Ampliar"   /> 
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #2 (permalink)  
Antiguo 06/07/2009, 08:26
Avatar de Dragon_Mandarin  
Fecha de Ingreso: marzo-2005
Ubicación: Santiago de Chile
Mensajes: 231
Antigüedad: 19 años, 1 mes
Puntos: 14
Respuesta: problema redimencionador de imagenes

¿Probaste dejar solamente uno de los parámetros, el alto, por ejemplo?

A lo mejor ahí está la solución.

Salu2
  #3 (permalink)  
Antiguo 06/07/2009, 19:24
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: problema redimencionador de imagenes

mmmm no es la idea creo yo,
que pasa si la imagen topa justo con el alto pero es muy muy grande en su ancho :/ no haría nada el script :/
en su efecto si dejo el alto 500 y la imagen es de 300 igual este script me trata de llevar la imagen de 300 a 500 :/ que es a lo que voy....

saludos
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #4 (permalink)  
Antiguo 06/07/2009, 19:29
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: problema redimencionador de imagenes

Ya estas usando getimagesize() esa te regresa el alto y ancho, agrega un if() para verificar si es mas alto o ancho y en dado caso si no cumple no la redimensionas.

Saludos.
  #5 (permalink)  
Antiguo 06/07/2009, 20:37
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: problema redimencionador de imagenes

si ya lo había pensado pero no logro hacer o decirle ¿como? al script que no lo redimencione, digo tomo los $datos y getimagesize(); me hace
$datos[0] = alto que deberia compararlo con $hmax y
$datos[1] = ancho que deberia compararlo con $anchura,
algo como : if (($datos[0] < $hmax) && ($datos[1]) < $anchura)
pero me viene el problema de como hago ese if y regresarle al script que no haga nada, tendria que revisar la extension nuevamente etc..? :/ de seguro es una burrada pero no lo condigo
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #6 (permalink)  
Antiguo 06/07/2009, 22:00
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: problema redimencionador de imagenes

Pues como lo estas cargando directo desde un <img> puedes usar algo asi:
Código php:
Ver original
  1. if ($height < $max_height) {
  2.        readfile($the_file);
  3. } else {
  4.        redimensiona($the_file);
  5. }

Saludos.
  #7 (permalink)  
Antiguo 06/07/2009, 23:27
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: problema redimencionador de imagenes

eso era readfile lo que me faltaba para pasarle como parametro, me funciona perfecto gracias gatorv
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #8 (permalink)  
Antiguo 07/07/2009, 20:04
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: problema redimencionador de imagenes

vuelvo a molestar :P le he puesto a mi script algunos if para ver si las imagenes no pasan el tamaño que yo quiero de lo contrario no se redimencionan :/ pero con una imagen a 1024*768 no me funciona en cambio le pongo una imagen de 1900*1200 y si lo hace algun error le ven al codigo :/ y si se puede mejorar algo no duden en comentarmelo :)

yo trabajaba con la clase de okram pero o usaba la para php4 o php5 y necesito una que me corra en ambos php por ello opte por meter mano a una mas imple :)
saludos...

Código php:
Ver original
  1. <?php
  2. //datos que recibire por GET alto y ancho
  3. $anchura= $_GET['ancho']; //max ancho 850
  4. $hmax= $_GET['alto']; //maximo alto 450
  5. $nombre=$_GET['archivo'];
  6. $datos = getimagesize($nombre);
  7. if (($datos[0] >= $hmax) && ($datos[1]) <= $anchura)
  8. {
  9. readfile($nombre);
  10. }
  11. elseif (($datos[0] <= $hmax) && ($datos[1]) <= $anchura)
  12. {
  13. readfile($nombre);
  14. }
  15. elseif (($datos[0] <= $hmax) && ($datos[1]) >= $anchura)
  16. {
  17. readfile($nombre);
  18. }
  19. elseif (($datos[0] >= $hmax) && ($datos[1]) >= $anchura)
  20. {
  21. if($datos[2]==1){$img = @imagecreatefromgif($nombre);}
  22. if($datos[2]==2){$img = @imagecreatefromjpeg($nombre);}
  23. if($datos[2]==3){$img = @imagecreatefrompng($nombre);}
  24. $ratio = ($datos[0] / $anchura);
  25. $altura = ($datos[1] / $ratio);
  26. if($altura>$hmax){$anchura2=$hmax*$anchura/$altura;$altura=$hmax;$anchura=$anchura2;}
  27. $thumb = imagecreatetruecolor($anchura,$altura);
  28. imagecopyresampled($thumb, $img, 0, 0, 0, 0, $anchura, $altura, $datos[0], $datos[1]);
  29. if($datos[2]==1){header("Content-type: image/gif"); imagegif($thumb);}
  30. if($datos[2]==2){header("Content-type: image/jpeg");imagejpeg($thumb);}
  31. if($datos[2]==3){header("Content-type: image/png");imagepng($thumb); }
  32. imagedestroy($thumb);
  33. }
  34. else
  35. {
  36. readfile($nombre);
  37. }
  38. ?>
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #9 (permalink)  
Antiguo 07/07/2009, 21:39
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: problema redimencionador de imagenes

Lee tu logica:
Código:
if (el ancho es mayor o igual al alto maximo y el alto es menor o igual al ancho maximo) {
      // no redimensiona
} elseif (el ancho es menor o igual al alto maximo y el alto es menor o igual al ancho maximo) {
     // no redimensiona
} elseif (el ancho es menor o igual al alto maximo y el alto es mayor o igual al ancho maximo) {
     // no redimensiona
} elseif( el ancho es mayor o igual al alto maximo y el alto es mayor o igual al ancho maximo) {
    // redimensiona
} else {
    // no redimensiona
}
Creo tienes un pequeño problema en tu logica

Saludos.
  #10 (permalink)  
Antiguo 07/07/2009, 23:56
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: problema redimencionador de imagenes

si me fije :P pero he tratado con numeritos en una hoja mayor menor etc....

y tengo entradas 1024*768 y 100*100 y 1000*50 y 50*1000 por decir algo ancho y alto respectivamente.....

caso 1 : (ancho_entrada >= 850) && (altoentrada >=450) = redimenciono.....
si pruebo con cada una de las 4 imagenes posibles es valido este if.....

caso 2 : (ancho_entrada <= 850) && (altoentrada <=450) = no redimenciono.....
si pruebo con cada una de las 4 imagenes posibles es valido este if.....

caso 3 : (ancho_entrada <= 850) && (altoentrada >=450) .... redimenciono

caso 4 : (ancho_entrada >= 850) && (altoentrada <=450) .... redimenciono

entonces mi script quedo

Código php:
Ver original
  1. <?php
  2. $anchura= $_GET['ancho']; //768
  3. $hmax= $_GET['alto'];
  4. $nombre=$_GET['archivo'];
  5. $datos = getimagesize($nombre);
  6. if (($datos[0] <= $hmax) && ($datos[1] <= $anchura))
  7. {
  8. readfile($nombre);
  9. }
  10. else
  11. {
  12. if($datos[2]==1){$img = @imagecreatefromgif($nombre);}
  13. if($datos[2]==2){$img = @imagecreatefromjpeg($nombre);}
  14. if($datos[2]==3){$img = @imagecreatefrompng($nombre);}
  15. $ratio = ($datos[0] / $anchura);
  16. $altura = ($datos[1] / $ratio);
  17. if($altura>$hmax){$anchura2=$hmax*$anchura/$altura;$altura=$hmax;$anchura=$anchura2;}
  18. $thumb = imagecreatetruecolor($anchura,$altura);
  19. imagecopyresampled($thumb, $img, 0, 0, 0, 0, $anchura, $altura, $datos[0], $datos[1]);
  20. if($datos[2]==1){header("Content-type: image/gif"); imagegif($thumb);}
  21. if($datos[2]==2){header("Content-type: image/jpeg");imagejpeg($thumb);}
  22. if($datos[2]==3){header("Content-type: image/png");imagepng($thumb); }
  23. imagedestroy($thumb);
  24. }
  25. ?>

pero tengo una imagen de 704*396 y me la alarga de igual manera cosa que no deberia es un jpg :/ digo si le pongo
if (($datos[0] >= $hmax) && ($datos[1]) <= $anchura)
que no me redimencione entonces esa imagen me la deja ok, pero las de 1024*768 no la redimenciona, creo que debe ser que me falta el almuerzo X)....
si alguien se ilumina bienvenido....

gracias gatorv seguiré revisando
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #11 (permalink)  
Antiguo 08/07/2009, 05:02
Avatar de Dragon_Mandarin  
Fecha de Ingreso: marzo-2005
Ubicación: Santiago de Chile
Mensajes: 231
Antigüedad: 19 años, 1 mes
Puntos: 14
Respuesta: problema redimencionador de imagenes

Hola,

si te interesa, te dejo este código para que lo modifiques y adaptes a tu gusto; en una de ésas te sirve. Bueno, ahí ves tú.

chau

----------------------

Código PHP:
 
<FORM action="redimensionar.php" encType="multipart/form-data" method="post" name="sendform">
  <h2>
    <INPUT name=MAX_FILE_SIZE type=hidden value=10000000>
    <INPUT maxLength=128 name=image type=file   ACCEPT="image/gif, image/jpeg, image/jpg">
    <br>
    <INPUT name=Submit type=submit value=Enviar>
    <INPUT name=Reset  type=reset value=Limpiar>
  </h2>
</FORM>
<h2>
  <?PHP
#############################################################################################
$IMG_ORG_HEIGHT "700"#Width of original image stored on server
$IMG_ORG_WIDTH  "700"#Height of original image stored on server
      #set to "*" to prevent resizing on the dimension
      #you will not lost X to Y ratio 
 
$IMG_HEIGHT 100;    # Accepted height of resized image
$IMG_WIDTH  100;    # Accepted width of resized image
      # read about "*" above
$IMG_ROOT "uploads/fotos";  # Relative path to folder where uploaded images will be stored; no ending slash! 
   # Like this: $IMG_ROOT = "./img"; 
   # Remeber to set proper attributes to that folder. 777 will work :)
$use_imagecreatetruecolor true// these flags enble ImageCreateTrueColor(); ImageCopyResampled();
$use_imagecopyresampled   true;// I cant test them coz my host doesn't allow these...
$JPG_QUALITY 90// output jpeg quality
#############################################################################################
//error_reporting(53); // dont need ur warnings!
if(!$HTTP_POST_FILES ["image"]["tmp_name"] || $HTTP_POST_FILES ["image"]["tmp_name"] =="none") die("<h5>Subir fotos permitidas, por favor.</h5><br>");
if( ! 
$f_org resizer_main("image","",$IMG_ORG_WIDTH,$IMG_ORG_HEIGHT))die("<br><font color=\"red\"><b>No Image received...</b></font><br>");
if( ! 
$f_res resizer_main("image","res_",$IMG_WIDTH,$IMG_HEIGHT))die("<br><font color=\"red\"><b>Not resized :( </b></font><br>");
 
$sz_org =getimagesize"$IMG_ROOT/$f_org" );
$sz_res =getimagesize"$IMG_ROOT/$f_res" );
$fs_orgfilesize("$IMG_ROOT/$f_org" );
$fs_resfilesize("$IMG_ROOT/$f_res" );
$html =<<< EHTML
<table width="80%" border="1" align="center">
  <tr> 
    <td colspan="2"><b>Imagen Original:</b></td>
  </tr>
  <tr> 
    <td colspan="2">
      <div align="center"><img src="$IMG_ROOT/$f_org" $sz_org
[3]></div>
    </td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Tamaño permitido: </div>
    </td>
    <td width="53%">$IMG_ORG_WIDTH x $IMG_ORG_HEIGHT</td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Tamaño Guardado: </div>
    </td>
    <td width="53%">$sz_org
[0] x $sz_org[1]</td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Tamaño del Archivo: </div>
    </td>
    <td width="53%">$fs_org</td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Calidad JPG: </div>
    </td>
    <td width="53%">$JPG_QUALITY</td>
  </tr>
  <tr> 
    <td colspan="2"><b>Imagen redimensionada:</b></td>
  </tr>
  <tr> 
    <td colspan="2">
      <div align="center"><img src="$IMG_ROOT/$f_res" $sz_res
[3]></div>
    </td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Tamaño permitido: </div>
    </td>
    <td width="53%">$IMG_WIDTH x $IMG_HEIGHT</td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Tamaño salvado: </div>
    </td>
    <td width="53%">$sz_res
[0] x $sz_res[1]</td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Tamaño del archivo: </div>
    </td>
    <td width="53%">$fs_res</td>
  </tr>
  <tr> 
    <td width="47%"> 
      <div align="right">Calidad imagen JPG: </div>
    </td>
    <td width="53%">$JPG_QUALITY</td>
  </tr>
</table>
EHTML;
echo 
$html;
 
 
#############################################################################################
function resizer_main($image$dest_file_prefix,$w$h){
//image_name = uploaded image. Name or your file field in your form.
//w,h - width and height to fit image in
global $use_imagecreatetruecolor$use_imagecopyresampled$IMG_ROOT$JPG_QUALITY$HTTP_POST_FILES;
$image_name $HTTP_POST_FILES [$image]["name"];
$image $HTTP_POST_FILES [$image]["tmp_name"];
if(
trim($image) == "" || trim($image) =="none") return false;
 
$arr_img image_from_upload($image);
 if( 
$arr_img["w"] != $w && $arr_img["h"] != $h){
  
$wh get_sizes($arr_img["w"], $arr_img["h"], $w$h);
  
$img_res img_get_resized(
   
$arr_img["img"], 
   
$arr_img["w"], $arr_img["h"], 
   
$wh["w"],  $wh["h"], 
   
$use_imagecreatetruecolor
   
$use_imagecopyresampled);
 } else {
   
//wow it is exactly like needed!!!
   
$img_res $arr_img["img"];
 }
 
$file_name make_filename($image_name$dest_file_prefix);
 
ImageJPEG($img_res,"$IMG_ROOT/$dest_file_prefix$file_name"$JPG_QUALITY);
 return 
"$dest_file_prefix$file_name";
}
function 
image_from_upload($uploaded_file){
 
$img_sz =  getimagesize$uploaded_file );  ## returns array with some properties like dimensions and type;
 ####### Now create original image from uploaded file. Be carefull! GIF is often not supported, as far as I remember from GD 1.6
 
switch( $img_sz[2] ){
  case 
1
   
$img_type "GIF";
   
$img ImageCreateFromGif($uploaded_file); 
  break;
  case 
2
   
$img ImageCreateFromJpeg($uploaded_file); 
   
$img_type "JPG";
  break;
  case 
3
   
$img ImageCreateFromPng($uploaded_file); 
   
$img_type "PNG";
  break;
  case 
4
   
$img ImageCreateFromSwf($uploaded_file); 
   
$img_type "SWF";
  break;
  default: die(
"<br><font color=\"red\"><b>Sorry, this image type is not supported yet.</b></font><br>");
 }
//case
 
return array("img"=>$img"w"=>$img_sz[0], "h"=>$img_sz[1], "type"=>$img_sz[2], "html"=>$img_sz[3]);
}
 
function 
get_sizes($src_w$src_h$dst_w,$dst_h ){
 
//src_w ,src_h-- start width and height
 //dst_w ,dst_h-- end width and height
 //return array  w=>new width h=>new height mlt => multiplier
 //the function tries to shrink or enalrge src_w,h in such a way to best fit them into dst_w,h
 //keeping x to y ratio unchanged
 //dst_w or/and dst_h can be "*" in this means that we dont care about that dimension
 //for example if dst_w="*" then we will try to resize by height not caring about width 
 //(but resizing width in such a way to keep the xy ratio)
 //if both = "*" we dont resize at all.
 #### Calculate multipliers
 
$mlt_w $dst_w $src_w;
 
$mlt_h $dst_h $src_h;
 
$mlt $mlt_w $mlt_h $mlt_w:$mlt_h;
 if(
$dst_w == "*"$mlt $mlt_h;
 if(
$dst_h == "*"$mlt $mlt_w;
 if(
$dst_w == "*" && $dst_h == "*"$mlt=1;
 
#### Calculate new dimensions
 
$img_new_w =  round($src_w $mlt);
 
$img_new_h =  round($src_h $mlt);
 return array(
"w" => $img_new_w"h" => $img_new_h"mlt_w"=>$mlt_w"mlt_h"=>$mlt_h,  "mlt"=>$mlt);
}
function 
img_get_resized($img_original,$img_w,$img_h,$img_new_w,$img_new_h,$use_imagecreatetruecolor=false$use_imagecopyresampled=false){
 
//$img_original, -- image to be resized
 //$img_w, -- its width
 //$img_h, -- its height
 //$img_new_w, -- resized width
 //$img_new_h -- height
 //$use_imagecreatetruecolor, $use_imagecopyresampled allow use of these function 
 //if they exist on the server
 
if( $use_imagecreatetruecolor && function_exists("imagecreatetruecolor")){
//  echo("Using ImageCreateTruecolor (better quality)<br>");
  
$img_resized imagecreatetruecolor($img_new_w,$img_new_h) or die("<br><font color=\"red\"><b>Failed to create destination image.</b></font><br>"); 
 } else {
//  echo("Using ImageCreate (usual quality)<br>");
  
$img_resized imagecreate($img_new_w,$img_new_h) or die("<br><font color=\"red\"><b>Failed to create destination image.</b></font><br>"); 
 }
 if(
$use_imagecopyresampled && function_exists("imagecopyresampled")){
//  echo("Using ImageCopyResampled (better quality)<br>");
  
imagecopyresampled($img_resized$img_original0000,$img_new_w$img_new_h$img_w,$img_h) or die("<br><font color=\"red\"><b>Failed to resize @ ImageCopyResampled()</b></font><br>"); 
 }else{
//  echo("Using ImageCopyResized (usual quality)<br>");
  
imagecopyresized($img_resized$img_original0000,$img_new_w$img_new_h$img_w,$img_h) or die("<br><font color=\"red\"><b>Failed to resize @ ImageCopyResized()</b></font><br>"); 
 }
 return 
$img_resized;
}
function 
make_filename($image_name){
 
## creates unique name, here I assume that it will never happen that in same second 
 ## two files with same name on user's site will be uploaded. However you can use your
 ## ways to generate unique name. Function unqueid() for example.
 
$file_name time()."_$image_name";    
 
#kick the original extension
 
$pos strrpos($file_name'.');
 
//personally I think jpeg rulez so I hardoce its extension here
 
$file_name substr($file_name0,$pos).".jpg";
 return 
$file_name;
}
?>

Última edición por Dragon_Mandarin; 08/07/2009 a las 05:07
  #12 (permalink)  
Antiguo 08/07/2009, 11:23
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: problema redimencionador de imagenes

Pues creo solo debes de comparar si el alto y el ancho son mayores a tus limites para redimensionar, no entiendo para que tantos ifs..

Saludos.
  #13 (permalink)  
Antiguo 08/07/2009, 14:34
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: problema redimencionador de imagenes

jajajaaj si sorry gatorv ya lo resolví :P era un solo if el problema era que yo tenia

if (($datos[0] <= $hmax) && ($datos[1] <= $anchura)) en ves de

if (($datos[0] <= $anchura) && ($datos[1] <= $hmax))

ahora recien vine a caer, que pasa si los cambio, a veces las cosas son tan fáciles pero uno no las ve, gracias a ambos :)
Dragon_Mandarin, tu código es para uploads yo solo queria hacer un redimencionamiento de imágenes al pasar variables saludos

__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #14 (permalink)  
Antiguo 08/07/2009, 14:52
Avatar de Dragon_Mandarin  
Fecha de Ingreso: marzo-2005
Ubicación: Santiago de Chile
Mensajes: 231
Antigüedad: 19 años, 1 mes
Puntos: 14
Respuesta: problema redimencionador de imagenes

Cita:
Iniciado por kaninox Ver Mensaje
jajajaaj si sorry gatorv ya lo resolví :P era un solo if el problema era que yo tenia

if (($datos[0] <= $hmax) && ($datos[1] <= $anchura)) en ves de

if (($datos[0] <= $anchura) && ($datos[1] <= $hmax))

ahora recien vine a caer, que pasa si los cambio, a veces las cosas son tan fáciles pero uno no las ve, gracias a ambos :)
Dragon_Mandarin, tu código es para uploads yo solo queria hacer un redimencionamiento de imágenes al pasar variables saludos

Hola, Kaninox!

QUe bueno que has podido resolver tu problema.

Respecto del código que te envié, en efecto es para hacer uploads, pero también te redimensiona la foto, generando una miniatura. No se si probaste este script, pero es bastante interesante y útil.

chau
  #15 (permalink)  
Antiguo 04/08/2009, 10:13
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
holas sorry por molestar nuevamente con esto, pero resulta que tengo este script corriendo bajo 3 servers 1 con php4 y dos con php5 y va muy bien pero tengo un server con php5 nuevo y no me toma el script, y eso que esta activada la libreria gd??
alguien sabe que mas podria pasar???

saludos

edito trate de correr el script con una imagen directa pero me salen puros garabatos, les copiare un trozo

Código php:
Ver original
  1. ÿØÿà&#65533;JFIF������ÿþ�>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛ�C�    $.' ",#(7),01444'9=82<.342ÿÛ�C  2!!22222222222222222222222222222222222222222222222222ÿÀ�ôd"�ÿÄ����������� ÿÄ�µ���}�!1AQa"q2�‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤

help!!!!!

era una estupidez había que darle permisos al archivo eso era todo.... :P
__________________
Gokuh Salvo al mundo. PUNTO!!!!

Última edición por GatorV; 04/08/2009 a las 11:23
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:43.