Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/08/2008, 18:59
Avatar de JoseAlejandro_Realza
JoseAlejandro_Realza
 
Fecha de Ingreso: agosto-2008
Ubicación: Maracay - Venezuela
Mensajes: 192
Antigüedad: 15 años, 9 meses
Puntos: 2
Respuesta: Redimensionar imagenes por Upload

Bueeno... leyendo aqui y alla tengo este script pero me marca error, podrian ayudarme...?

aca tengo el o que carga el archivo que lo llamaremos cargar.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Subir archivos</title>
<link rel="STYLESHEET" type="text/css" href="estilos_admin.css">
<style type="text/css">
<!--
.style1 {
font-family: "Brush Script MT";
color: #FF0000;
font-size: 36pt;
}
body {
background-color: #006699;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body>
<h1 class="style1">Sube Tu Foto! <img src="fotos/incognita.jpg" width="126" height="109"></h1>
<br>
<form action="redimension.php" method="post" enctype="multipart/form-data">
<br>
<input type="hidden" name="MAX_FILE_SIZE" value="100000000">
<br>
<br>
<b>Cargar Foto : </b>
<br>
<input name="userfile" type="file">
<br>
<input type="submit" value="Enviar">
</form>
</body>
</html>

aca viene el script que se encarga de montar la imagen y redimensionar:

<?php

//damos la ruta de carpeta donde guardarlo todo
$uploadDir = 'fotos/';

//damos el archivo
$file=$_FILES['Filedata']['name'];

//damos el archivo temporal (importante) es el que moveremos con move_uploaded_file
$tmp_name = $_FILES['Filedata']['tmp_name'];

//el archivio con su ruta
$uploadFile = $uploadDir . $file;

//movemos la imagen upload
move_uploaded_file($tmp_name, $uploadFile);

//sacamos la ruta de thumb quitandole el .jpg
$getUploadThumbFile = basename($uploadFile, ".jpg");

//el archivio thumb al que le incorporamos _thumb.jpg
$UploadThumbFile = $getUploadThumbFile . '_thumb.jpg';

// $imagen = imagecreatefromjpeg($tmp_name);
$imagen_thumb = imagecreatefromjpeg($uploadFile);

//aqui ponemos las opciones deseadas para la thumbnail
$anchoElegido = 100 ;
$altoElegido = 80 ;
$calidad = 50 ;

// Creamos una imagen vacia
$thumb = imagecreatetruecolor($anchoElegido,$altoElegido);

// Copiamos la thumbnail image a la imagen creada
imagecopyresampled($thumb,$imagen_thumb,0,0,0,0, $anchoElegido,$altoElegido,imagesx($imagen_thumb), imagesy($imagen_thumb));

//damos salida a la imagen thumbnail creada y copiada.
imagejpeg($thumb, $UploadThumbFile, $calidad);

?>

cuando intengo sibir las fotos me marca este Horror.!

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/enmaraca/public_html/redimension.php on line 25

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'fotos/' is not a valid JPEG file in /home/enmaraca/public_html/redimension.php on line 25

Warning: imagesx(): supplied argument is not a valid Image resource in /home/enmaraca/public_html/redimension.php on line 36

Warning: imagesy(): supplied argument is not a valid Image resource in /home/enmaraca/public_html/redimension.php on line 36

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/enmaraca/public_html/redimension.php on line 36

Warning: imagejpeg() [function.imagejpeg]: Unable to open 'fotos_thumb.jpg' for writing: Permission denied in /home/enmaraca/public_html/redimension.php on line 39

y ya no se que hacer


http://www.enmaracay.net/cargar.php