Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jakość miniaturek
Kyo
post 13.05.2004, 12:43:52
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
 
Start new topic
Odpowiedzi (1 - 2)
Jojo
post 13.05.2004, 12:44:59
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.


--------------------
Rozwój cywilizacji informatycznej to wyścig między programistami, którzy wytwarzają coraz łatwiejsze
programy użytkowe dla idiotów, a światem produkującym coraz lepszych gatunkowo idiotów.

Blog: Małolepszy.info
Go to the top of the page
+Quote Post
scanner
post 13.05.2004, 13:55:11
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 )


--------------------
scanner.info
Warto pamiętać: KISS, DRY
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 01:41