ritono nuovamente a chiedere voi come faccio a fare un upload di un file che nello stesso tempo venga ridimensionato....
mi sto ammazzando a fare il codice che mi permetta di fare questo ... ma senza risultati .
sono riuscito solo a gare l'uoload del file e fare il get size ma non mi riesce di modificare le dimensioni ...
ecco il codice che ho scritto potreste dirmi dove sbaglio?
pagina : pag1.php3
codice:
<HTML><HEAD>
<TITLE>Untitled</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<form method=POST action=pag2.php3 enctype=multipart/form-data>
Files to upload:
<input type=file name=img1 size=30>
<input type="submit" name="submit" value="Upload">
</form>
</BODY>
</HTML>
pagina : pag2.php3
codice:
<?
//user defined variables
$abpath = "/membri/test10000/img"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "250000000"; //What do you want size limited to be if there is one
//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/ief"; //Ief type
$cert5 = "image/png"; //Png type
$cert6 = "image/tiff"; //Tiff type
$cert7 = "image/bmp"; //Bmp Type
$cert8 = "image/vnd.wap.wbmp"; //Wbmp type
$cert9 = "image/x-cmu-raster"; //Ras type
$cert10 = "image/x-x-portable-anymap"; //Pnm type
$cert11 = "image/x-portable-bitmap"; //Pbm type
$cert12 = "image/x-portable-graymap"; //Pgm type
$cert13 = "image/x-portable-pixmap"; //Ppm type
$cert14 = "image/x-rgb"; //Rgb type
$cert15 = "image/x-xbitmap"; //Xbm type
$cert16 = "image/x-xpixmap"; //Xpm type
$cert17 = "image/x-xwindowdump"; //Xwd type
$log = "";
//begin upload 1
//checks if file exists
if ($img1_name == "") {
$log .= "No file selected for upload 1
";
}
if ($img1_name != "") {
//checks if file exists
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 already existed
";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img1_size > $size) {
$log .= "File 1 was too big
";
}
}
//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3) or ($img1_type == $cert4) or ($img1_type == $cert5) or ($img1_type == $cert6) or ($img1_type == $cert7) or ($img1_type == $cert8) or ($img1_type == $cert9) or ($img1_type == $cert10) or ($img1_type == $cert11) or ($img1_type == $cert12) or ($img1_type == $cert13) or ($img1_type == $cert14) or ($img1_type == $cert15) or ($img1_type == $cert16) or ($img1_type == $cert17)) {
@copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server
";
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 was uploaded
";
}
} else {
$log .= "File 1 is not an image
";
}
}
}
Print ("$log");
list($width, $height, $type, $attr) = getimagesize("$abpath/$img1_name");
$arrivo = $abpath . "/piccolo/" . $img1_name;
$part = $abpath . "/" . $img1_name;
imagecopyresized($arrivo, $part, 0, 0, 0, 0, $width, $height, $width, $height) ;
if ($ci)
{
print ("Resize eseguito");
}
else
{
print ("Resize non riuscito");
print ( "$arrivo, $part, 0, 0, 0, 0, 25, 25, $width, $height");
}
?>
e dopo tutto provo a fare l'upload e mi esce quelo che ha fatto
File 1 was uploaded
Resize non riuscito/membri/test10000/img/piccolo/ssfondobnrforum.jpg, /membri/test10000/img/ssfondobnrforum.jpg, 0, 0, 0, 0, 25, 25, 1000, 150
e di fatti le dimensioni sono esatte quelle che prende e il file melo uppa ma non lo ridimensiona in un altra cartella ...
Raga ormai é quasi un mese che sto cercando di farlo funzionare ... VI prego AIUTATEMI