Ciao, grazie adesso non ho più quell'errore, tuttavia non riesco a far funzionare lo script..
potresti darmi una mano?!
ecco la funzione in testa alla pagina:
codice:
<?php ob_start();
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($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);}
elseif( $size[2] == 1 ){@imagegif($new);}
elseif( $size[2] == 3 ){@imagepng($new);}
@imagedestroy($im);
@imagedestroy($new);
}
e dopo, dove necessario ho messo:
codice:
$src = $row["fotolink"]; // dove $src è un link ad un immagine
$l = "100"; // ho provato anche con 100px
$new = OutThumb($src, $l);
Ho bisongo che $new sia un link all'immagine, che dovrò mettere come anteprima di un immagine...
Grazie per il tuo aiuto..