Ciao a tutti, attualmente utilizzo questo script per uploadare e ridimensionare delle foto, come potrei fare per utilizzarlo per fare l'upload di files PDF di massimo 3/400 Kb?
Grazie.
Codice PHP:
if ($urlfoto_name != "") {
if (file_exists("fotousato/$urlfoto_name"))
die ("ESISTE GIA' UN FILE FOTO CON LO STESSO NOME...SI PREGA DI RINOMINARE IL FILE");
copy("$urlfoto","foto/$urlfoto_name")
or die("Impossibile copiare il file!");
// find the image size
$imginfo = GetImageSize("foto/$urlfoto_name");
if ($imginfo == NULL)
die ("ERRORE");
$srcWidth = $imginfo[0];
if ($srcWidth > 640){
$srcHeight = $imginfo[1];
$ratioWidth = $srcWidth/640;
$ratioHeight = 0;
$destWidth = 640;
$destHeight = $srcHeight / $ratioWidth;
// Resize the picture
exec("convert -quality 100 -antialias -sample \"".$destWidth."x".(int)$destHeight."\" \"foto/$urlfoto_name\" \""."foto/1-"."$urlfoto_name\"");
$urlfoto = "http://www.miosito.it/foto/"."1-"."$urlfoto_name" ;
unlink("foto/$urlfoto_name");
}
else
$urlfoto = "http://www.miosito.it/foto/"."$urlfoto_name" ;
}
// questo lo usavo per mettere una immagine nofoto
else
$urlfoto = "http://www.miosito.it/foto/nofoto.jpg";