Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]GD, zapis obrazu
peter13135
post
Post #1





Grupa: Zarejestrowani
Postów: 1 447
Pomógł: 191
Dołączył: 26.03.2008

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


po interesującej konwersacji z manualem, udało mi sie wydobić taki kod php
  1. <?php
  2. // The file
  3. $filename = '01.jpg';
  4.  
  5. // Set a maximum height and width
  6. $width = 200;
  7. $height = 200;
  8.  
  9. // Content type
  10. header('Content-type: image/jpeg');
  11.  
  12. // Get new dimensions
  13. list($width_orig, $height_orig) = getimagesize($filename);
  14.  
  15. $ratio_orig = $width_orig/$height_orig;
  16.  
  17. if ($width/$height > $ratio_orig) {
  18.   $width = $height*$ratio_orig;
  19. } else {
  20.   $height = $width/$ratio_orig;
  21. }
  22.  
  23. // Resample
  24. $image_p = imagecreatetruecolor($width, $height);
  25. $image = imagecreatefromjpeg($filename);
  26. imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
  27.  
  28. // Output
  29. imagejpeg($image_p, null, 100);
  30. ?>


czy mógłby mi ktoś powiedziec w jaki sposób zapisać tan plik a nie wyświetlać??
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: 15.09.2025 - 15:21