Proszę o sprawdzenie poniżeszej funkcji. Tworzy ona miniaturki ale jest chyba jakiś błąd.
Czasami ucina zdjęcia i chyba nia potrafi rozpoznać formatu.
<? /* Proporcjonalne pomniejszanie zdjec */ function resizepics($pics, $newwidth, $newheight, $new){ $x1 = $newwidth; $x2 = $newheight; if($width > $height && $newheight < $height){ $newheight = $height / ($width / $newwidth); } else if ($width < $height && $newwidth < $width) { $newwidth = $width / ($height / $newheight); } else { $newwidth = $width; $newheight = $height; } $source = imagecreatefromjpeg($pics); $source = imagecreatefromjpeg($pics); } $source = imagecreatefromjpeg($pics); } $source = Imagecreatefromjpeg($pics); } $source = imagecreatefrompng($pics); } $source = imagecreatefromgif($pics); } $thumb = imagecreatetruecolor($x1, $x2); $white = imagecolorallocate($thumb,255,255,255); $x = ($x1 - $newwidth) / 2; $y = ($x2 - $newheight) / 2; imagefill($thumb, 1, 1, $white); imagecopyresampled($thumb, $source, $x, $y, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb, $new); imagejpeg($thumb, $new); } imagejpeg($thumb, $new); } imagejpeg($thumb, $new); } imagepng($thumb, $new); } imagegif($thumb, $new); } } ?>
Bardzo dziękuję za pomoc