Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Generowanie minaiturek o kiepskiej jaości
Ciupaska
post
Post #1





Grupa: Zarejestrowani
Postów: 82
Pomógł: 0
Dołączył: 25.05.2009

Ostrzeżenie: (10%)
X----


Witam, poniższy kod odpowiedzialny jest u mnie za generowanie miniaturki wrzuconego obrazu.
Jednak zamiast zrobić miniaturkę:
1. (IMG:http://warez24.net/img2/20thumb.jpeg)
robi taką:
2. (IMG:http://warez24.net/img2/745_tn.jpg)

W kodzie:
  1. <?php
  2. imagejpeg($target_id, $tnFile, 75);
  3. ?>

zmieniałem 75 na 100. Miniaturka minimalnie się zmienia, ale nadal wszystko jest rozmyte.
(Miniaturka 2 wygenerowana właśnie opcją 100. na 75 jest podobnie.

Nie mogę zupełnie dojść czemu tak psuje miniaturki...


  1. <?php
  2. // create thumb
  3.  
  4.                                        if ($true_width > $thumbnail_size_max || $true_height > $thumbnail_size_max)
  5.  
  6.                                                {
  7.  
  8. $ratio1=$true_width/$dest_width;
  9. $ratio2=$true_height/$dest_height;
  10. if($ratio1>$ratio2) {
  11. $thumb_w=$dest_width;
  12. $thumb_h=$true_height/$ratio1;
  13. }
  14. else {
  15. $thumb_h=$dest_height;
  16. $thumb_w=$true_width/$ratio2;
  17. }
  18.  
  19.  
  20. $target_id = imagecreatetruecolor($thumb_w, $thumb_h);
  21.  
  22. $target_pic = imagecopyresized($target_id, $source_id, 0, 0, 0, 0, $thumb_w, $thumb_h, $true_width, $true_height);
  23.  
  24.  
  25.                                                        // create a thumbnail in JPEG format
  26.  
  27.                                                        imagejpeg($target_id, $tnFile, 75);
  28.  
  29.                                                        imagedestroy($target_id);
  30.  
  31.                                                }
  32.  
  33.                                        else
  34.  
  35.                                                {
  36.  
  37.                                                        copy($newFile, $tnFile);
  38.  
  39.                                                }
  40.  
  41.                                        if($no_server=="0")
  42.  
  43.                                         {
  44.  
  45.                                            $ftp->put($tnFileName,$tnFile);
  46.  
  47.                                            $ftp->close();
  48.  
  49.                                            if(file_exists($newFile))
  50.  
  51.                                            {
  52.  
  53.                                             unlink($newFile);
  54.  
  55.                                            }
  56.  
  57.                                            if(file_exists($tnFile))
  58.  
  59.                                            {
  60.  
  61.                                             unlink($tnFile);
  62.  
  63.                                            }
  64.  
  65.                                            }
  66.  
  67.                                }
  68.  
  69.                }
  70.  
  71.                
  72.  
  73. }
  74.            
  75.  
  76. }
  77.  
  78. mysql_close($link);
  79. ?>


Proszę o pomoc (IMG:http://forum.php.pl/style_emoticons/default/worriedsmiley.gif)

PS: Jeśli ktoś chce zerknąć na cały plik uploader.php
http://www8.speedyshare.com/data/801257379.../1/uploader.txt

Ten post edytował Ciupaska 21.07.2009, 21:03:30
Go to the top of the page
+Quote Post

Posty w temacie


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: 25.08.2025 - 02:28