Foros del Web » Programando para Internet » PHP »

subir y redimensionar

Estas en el tema de subir y redimensionar en el foro de PHP en Foros del Web. Hola, soy nuevo en esto y tengo un script que no puedo hacer funcionar, cuando le doy clikc al boton pareciera que carga la foto, ...
  #1 (permalink)  
Antiguo 03/06/2009, 12:42
 
Fecha de Ingreso: junio-2009
Mensajes: 31
Antigüedad: 14 años, 10 meses
Puntos: 0
Sonrisa subir y redimensionar

Hola, soy nuevo en esto y tengo un script que no puedo hacer funcionar, cuando le doy clikc al boton pareciera que carga la foto, pero al final me muestra la pagina como que cargo, pero no muestra ninguna imagen y tampoco subio nada al servidor, Espero que alguien me pueda decir que estoy haciendo mal. Gracias
aqui les dejo el script
<form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
<input name="new_image" id="new_image" size="30" type="file" class="fileUpload" />
<button name="submit" type="submit" class="submitButton">Upload/Resize Image</button>
</form>
<?php
if(isset($_POST['submit'])){
if (isset ($_FILES['new_image'])){
$imagename = $_FILES['new_image']['name'];
$source = $_FILES['new_image']['tmp_name'];
$target = "images/".$imagename;
move_uploaded_file($source, $target);

$imagepath = $imagename;
$save = "images/" . $imagepath; //This is the new file you saving
$file = "images/" . $imagepath; //This is the original file

list($width, $height) = getimagesize($file) ;

$modwidth = 150;

$diff = $width / $modwidth;

$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;

imagejpeg($tn, $save, 100) ;

$save = "images/sml_" . $imagepath; //This is the new file you saving
$file = "images/" . $imagepath; //This is the original file

list($width, $height) = getimagesize($file) ;

$modwidth = 80;

$diff = $width / $modwidth;

$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;

imagejpeg($tn, $save, 100) ;
echo "Large image: <img src='images/".$imagepath."'><br>";
echo "Thumbnail: <img src='images/sml_".$imagepath."'>";

}
}
?>
  #2 (permalink)  
Antiguo 03/06/2009, 12:43
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: subir y redimensionar

postea el codigo para saber
  #3 (permalink)  
Antiguo 03/06/2009, 12:52
Avatar de cesarpunk  
Fecha de Ingreso: enero-2008
Ubicación: Lima
Mensajes: 943
Antigüedad: 16 años, 3 meses
Puntos: 9
Respuesta: subir y redimensionar

Hay algun aporte de como hacer thumbnails con redimensionado exacto? me gustaria hacer uno porque veo que la gente tiene muchos problemas en eso
__________________
Quitenme la vida pero no la bebida.
  #4 (permalink)  
Antiguo 03/06/2009, 12:53
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
cesarpunk mira aqui http://www.forosdelweb.com/f18/reesc...-luego-702844/

podrias volver a modificar el codigo colocarlo dentro de [PHP] [/ PHP] quitale el espacio entro /PHP

Última edición por GatorV; 03/06/2009 a las 15:37
  #5 (permalink)  
Antiguo 03/06/2009, 15:23
 
Fecha de Ingreso: junio-2009
Mensajes: 31
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: subir y redimensionar

Cita:
Iniciado por abimaelrc Ver Mensaje
podrias volver a modificar el codigo colocarlo dentro de [PHP] [/ PHP] quitale el espacio entro /PHP
Hola, puede que no haya entendido, pero lo puse y no surte ningun efecto mas que mostrare [PHP] [/ PHP] abajo
  #6 (permalink)  
Antiguo 04/06/2009, 07:21
 
Fecha de Ingreso: junio-2009
Mensajes: 31
Antigüedad: 14 años, 10 meses
Puntos: 0
De acuerdo Respuesta: subir y redimensionar

Hola, ya encontre el problema y era una pavada, pero no la veia tenia escrita una letra menos en la en la carpeta del servidor y en vez de tener images, tenia image y ese era todo el problema. pero ya esta solucionado.
Gracias y saludos a todos
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 23:59.