imagefrompng e imagefromgif

z.cristiano

Utente Attivo
16 Giu 2007
145
0
16
Salve a tutti...
Perchè quando faccio così ridimensionamento GIF

PHP:
$new_width_grande = 90;
$new_height_grande = $height * ($new_width_grande/$width);

$thumb_grande = imagecreatetruecolor($new_width_grande, $new_height_grande);

$source_grande = imagecreatefromgif("../../contenuti/". $_FILES['foto']['name'] ."");

imagecopyresampled($thumb_grande, $source_grande, 0, 0, 0, 0, $new_width_grande, $new_height_grande, $width, $height);

$foto_grande = imagegif($thumb_grande, "../../contenuti/foto/big/". $tipo_foto ."", 300);

IL file gif diventa fisso, non animato? perchè?

Mentre PNG diventa tutto nero?

PHP:
$new_width_grande = 90;
$new_height_grande = $height * ($new_width_grande/$width);

$thumb_grande = imagecreatetruecolor($new_width_grande, $new_height_grande);

$source_grande = imagecreatefrompng("../../contenuti/". $_FILES['foto']['name'] ."");

imagecopyresampled($thumb_grande, $source_grande, 0, 0, 0, 0, $new_width_grande, $new_height_grande, $width, $height);

$foto_grande = imagepng($thumb_grande, "../../contenuti/foto/big/". $tipo_foto ."", 300);
 
Ultima modifica di un moderatore:
ciao
intanto racchiudi sempre il codice negli appositi tag [ PHP ], poi non mettere tante linee vuote.
comunque


PHP:
$foto_grande = imagegif($thumb_grande, "../../contenuti/foto/big/". $tipo_foto ."", 300);
$foto_grande = imagepng($thumb_grande, "../../contenuti/foto/big/". $tipo_foto ."", 300);
su imagegif non c' il fattore di compressione
PHP:
$foto_grande = imagegif($thumb_grande, "../../contenuti/foto/big/". $tipo_foto ."");
su imagepng il fattore di compressione va da 0 a 9, es-
PHP:
$foto_grande = imagepng($thumb_grande, "../../contenuti/foto/big/". $tipo_foto ."", 5);

p.s.
il ."" è in sovrappiù cioè non serve, es.
.......foto/big/". $tipo_foto, 5);

in imagejpg il fattore va da 0 a 100
 
Fatto, allora

per PNG funziona ma lo sfondo diventa NERO anzichè trasparente

per GIF funziona ma non animato, diventa fisso..

:-(
 
In questa pagina è presente una funzione (denominata "is_ani") che permette di rilevare se una Gif è animata o meno; prova a dare uno sguardo a questa classe, potrebbe esserti utile.