chi mi da una mano a fare in modo che questo script possa 'salvare' l'img sul server?
la funzione è presa da questo stesso sito
http://php.html.it/articoli/leggi/93...i-gd-in-php/3/
dove $l è la grandezza dell'img quadrata
Codice PHP:
function OutThumb($src, $l){
$size = getimagesize($src);
if( $size[2] == 2 ){$im = @imagecreatefromjpeg($src);}
elseif( $size[2] == 1 ){$im = @imagecreatefromgif($src);}
elseif( $size[2] == 3 ){$im = @imagecreatefrompng($src);}
if( $size[0]>$l or $size[1]>$l ){
$centerX = $size[0]/2;
$centerY = $size[1]/2;
if( $size[0] > $size[1] ){
$luy = 0;
$lux = $centerX-$centerY;
$rdy = $size[1];
$rdx = $size[1];
}
else{
$lux = 0;
$luy = $centerY-$centerX;
$rdx = $size[0];
$rdy = $size[0];
}
if( (GDVersion() == 2) AND ($size[2] != 1) ){
$new = imagecreatetruecolor($l, $l);
imagecopyresampled($new, $im, 0, 0, $lux, $luy, $l, $l, $rdx, $rdy);
}
else{
$new = imagecreate($l, $l);
imagecopyresized($new, $im, 0, 0, $lux, $luy, $l, $l, $rdx, $rdy);
}
}
else{
$new &= $im;
}
header('Content-Type: ' . $size['mime']);
if( $size[2] == 2 ){@imagejpeg($new, $fileOut, 100);}
elseif( $size[2] == 1 ){@imagegif($new, $fileOut);}
elseif( $size[2] == 3 ){@imagepng($new, $fileOut);}
@imagedestroy($im);
@imagedestroy($new);
}