Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> jakość miniaturek
Kyo
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 2.05.2004

Ostrzeżenie: (0%)
-----


Hej ! Do tworzenia miniaturek uzywam tego skryptu:

<?
function createThumb($sfile,$dfile)
{
// the passed variables are string filenames, the source and the destination

global $maxwidth,$maxheight;

$simg = imagecreatefromjpeg($sfile);
$currwidth=imagesx($simg);
$currheight=imagesy($simg);

//set the dimensions of the thumbnail
if ($currheight>$currwidth*1.7)
{
$zoom=$maxheight/$currheight;
$newheight=$maxheight;
$newwidth=$currwidth*$zoom;
}
else
{
$zoom=$maxwidth/$currwidth;
$newwidth=$maxwidth;
$newheight=$currheight*$zoom;
}

//create the resource img for the thumbnail
$dimg = imagecreate($newwidth, $newheight);

//convert truecolor immage resource to palette image resource (so we can count the colors...)
imagetruecolortopalette($simg, false, 256);
$palsize = ImageColorsTotal($simg);
for ($i = 0; $i<$palsize; $i++)
{
$colors = ImageColorsForIndex($simg, $i);
ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']);
}

imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight);
imagejpeg($dimg,$dfile);

ImageDestroy($simg);
ImageDestroy($dimg);
}
?>


mam jednak problem z jakoscia miniaturek. Myslalem ze ustaienie kompresji na 95 cos pomoze ale nic - dalej sa slabe - bo wsyztsko rozbija sie o sam mechanizm resize'u. Poniewaz nie znam dobrze tych polecen prosze o pomoc. Zainteresowac sie zupelnie innym skryptem czy poprawiac ten ? czy: imagecreatetruecolor cos tu pomoze ?
pozdrawiam
Go to the top of the page
+Quote Post
Jojo
post
Post #2





Grupa: Zarejestrowani
Postów: 405
Pomógł: 1
Dołączył: 19.09.2003
Skąd: Lublin

Ostrzeżenie: (0%)
-----


Użyj [manual:ac7941d737]imagecopyresampled[/manual:ac7941d737] a ponadto używaj znaczników BBCode.
Go to the top of the page
+Quote Post
scanner
post
Post #3





Grupa: Zarząd
Postów: 3 503
Pomógł: 28
Dołączył: 17.10.2002
Skąd: Wrocław




1. Było na forum
2. Brak BBCode
Zamykam
(thx: Dawid Pytel )
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 16:01