Jak w temacie mam problem z tworzeniem miniaturek . Tworzy tylko czarne obrazki .
function savethumb($image,$dest) {
$maxheight = 91;
$maxwidth = 135;
case '2': $im = imagecreatefromjpeg ($image);
break;
case '1' : $im = imagecreatefromgif ($image);
break;
case '3' : $im = imagecreatefrompng ($image);
break;
default : $stop = true;
break;
}
$result="";
$x = imagesx($im);
$y = imagesy($im);
if ($y > $x)
{
$ratio = $maxheight / $aa;
$newheight = $maxheight;
$newwidth = $x * $ratio;
$writex = round(($maxwidth - $newwidth) / 2
); $writey = 0;
}
else
{
$ratio = $maxwidth / $x;
$newwidth = $maxwidth;
$newheight = $y * $ratio;
$writex = 0;
$writey = round(($maxheight - $newheight) / 2
); }
$newimg = imagecreatetruecolor($maxwidth,$maxheight);
$palsize = ImageColorsTotal($im); //Get palette size for original image
for ($i = 0; $i < $palsize; $i++) //Assign color palette to new image
{
$colors = ImageColorsForIndex($im, $i);
ImageColorAllocate($newimg, $colors['red'], $colors['green'], $colors['blue']);
}
imagecopyresized($newimg, $im, $writex, $writey, 0, 0, $newwidth, $newheight, $x, $y);
imagejpeg($newimg, $dest, 80);
@chmod($dest, $new_chmod);
imagedestroy($im);
imagedestroy($newimg);
return $result;
} else return false;
}
Mysle ze poprostu zapisuje on $newimg czyli poprostu czarny obrazek bo nie jest on wypelniany ale nie mam pojecia jak go wypelnic wiec licze na wasza pomoc