Mam problem z zmianą rozmiaru obrazków.
Chodzi o to, że kiedy ładuje obrazek skrypt go proporcjonalnie zmniejsza i przerabia na obrazek do formatu JPG.
Wszystko jest wporządku jeżeli ładowany obrazek jest w formacie JPG lub JPEG.
Bład pojawia się wtedy kiedy do pomniejszania zostaje załadowany obrazek formatu GIF lub PNG.
Komunikat o błedzie mówi, że format ładowanego obrazka jest niepoprawny chidzi o funkcje (imagecopyresized).
Poniżej zamieszczam kod.
Bardzo proszę o pomoc co tutaj może być nie tak.
<?php 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 = 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); imagecopyresized($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); } } ?>