Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2009, 12:42
arielgon
 
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."'>";

}
}
?>