


Al final si que lo he conseguido hacer \o/ asi me ha quedado el codigo
Código PHP:
/*COMPROBACION SI SE HA SUBIDO UNA FOTO*/
$ruta="uploadify/uploads/".$idf."/";
if($dh = opendir($ruta)){
echo "<br>DH TRUE: ".$dh;
while (($file = readdir($dh))){
if($file!="."&&$file!=".."&&$file!="Thumbs.db"){
echo "<br>FICHERO: ".$file;
$noimagen="";
break;
}else{
$noimagen="error";
}
}
}
Código Javascript
:
Ver original$('#file_upload').uploadify({
'uploader' : 'uploadify/uploadify.swf',
'script' : 'uploadify/uploadify.php',
'multi' : true,
'auto' : true,
'queueSizeLimit' : 10,
'removeCompleted' : false,
'sizeLimit' : '1048576',
'buttonText': 'Sube tus fotos',
'cancelImg' : 'uploadify/cancel.png',
'folder' : 'uploadify/uploads/<?echo $idf?>/',
'fileExt' : '*.jpg',
'fileDesc' : 'Sube tus fotos (.jpg)',
'onComplete' : function(event, queueID, fileObj, response, data) {
$("#destino").load("recibe.php", {
fichero: fileObj.name,
pos: data.fileCount,
id: <?echo $idf?>
})
}/*on complete*/
});
RECIBE.PHP
Código PHP:
<script>alert('<?echo $_POST['pos'];?>: <img src="uploadify/uploads/<?echo $_POST['id'];?>/<?echo $_POST['fichero'];?>"/>');</script>
<?
$imagen=$_POST['fichero'];
$path='uploadify/uploads/'.$_POST['id'];
$original = imagecreatefromjpeg($path.'/'.$imagen);
$ancho = imagesx($original);
$alto = imagesy($original);
if ($ancho > $alto) {
$thumb = imagecreatetruecolor(145, 90);
imagecopyresampled($thumb, $original, 0, 0, 0, 0, 145, 90, $ancho, $alto);
} else {
$thumb = imagecreatetruecolor(145, 200);
imagecopyresampled($thumb, $original, 0, 0, 0, 0, 145, 200, $ancho, $alto);
}
$tipo = substr($imagen, -4);
$th = $path .'/'. $_POST['id'] . '-' . $_POST['pos'] . '-th' . $tipo;
imagejpeg($thumb, $th, 90); // 90 es la calidad de compresión
rename($path .'/'. $imagen, $path .'/'.$_POST['id']. '-' . $_POST['pos'] . $tipo);
?>
<?echo $_POST['pos'];?>: <img src="<?echo $th;?>"/>
Espero que a alguien le pueda servir de ayuda