Comunidad de diseño web y desarrollo en internet online

AYUDA: PHP Upload + una copia Miniatura

Citar            
MensajeEscrito el 29 Oct 2009 04:29 pm
Hola Amigos de Cristalab, necesito hacer un upload de una imagen y luego hacer
una copia en miniatura de la imagen que subí. Tengo un script parecido, que
funciona, pero no produce la copia miniatura.
El sector del código que se encarga de subir funciona perfectamente (estoy
usando fileReference desde flash), pero no puedo conseguir que me haga la
copia en miniatura con php de la imagen que subí.

El código es este:

Código PHP :

<?php

if ($_GET["action"] == "upload") { // lo estoy mandando desde Flash...
$archivo = $_FILES["Filedata"]['name'];
$prefijo = substr(md5(uniqid(rand())),0,6);

if ($archivo != "") {
$destino = "files/".$prefijo."_".$archivo;
copy($_FILES['Filedata']['tmp_name'], $destino);
}
} // HASTA ACÁ FUNCIONA BIEN

/*
Pero a partir de acá, este script no genera la imagen miniatura
en la carpeta 'thumbs'
*/

$filenameA = $destino.$archivo; 
$dirdestA = '/home/mi_user_name/public_html/Sharer/UNI/thumbs/';
/* ESTA ES LA CARPETA DESTINO CON TODOS LOS PERMISOS, IGUAL QUE LA CARPETA 
FILES DONDE SÍ SUBE LA IMAGEN.*/
$qualA= 100;

/********************************************************/   

$thumb = imagecreatetruecolor(150, 120); 
$source = imagecreatefromjpeg($filenameA);
$copia = imagecopyresized($thumb, // imagen creada
                                      $source, // imagen fuente
                                      0, // 
                                      0, // 
                                      0, // _x 
                                      0, // _y 
                                      150, // 
                                      120, // 
                                      150, // nuevo Ancho 
                                      120); // nuevo Alto 

mt_srand (time());
$numero_aleatorio = mt_rand(999999999999,0); 
$absoluto = abs($numero_aleatorio);
$nombre_imagen = $filenameA.$absoluto; // le agrego una cadena aletoria, por las dudas...

$dirdestA = '/home/mi_user_name/public_html/Sharer/UNI/thumbs/'; 
$salva=$dirdestA.$nombre_imagen;
imagejpeg($thumb, $salva.'.jpg', 100); 

imagedestroy($source);
imagedestroy($thumb);

?>


Y los error log que me aparecen son todos iguales:
no existe la imagen fuente; como si necesitaran estas dos
acciones operar con un delay de tiempo...
En fin, es raro para mí...

Muchas Gracias!!!

Por DiegoVelevu

50 de clabLevel



Genero:Masculino  

Buenos Aires

chrome
Citar            
MensajeEscrito el 31 Oct 2009 02:21 pm
Mira este enlace
http://www.buayacorp.com/archivos/guardar-una-imagen-y-su-miniatura-a-un-campo-blob-de-mysql/


Y cualquier cosa comentame. :)

El ayudar nos hace grandes :cool:

Por crmauricio

52 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.