Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Tworzenie miniatur błąd
wlamywacz
post
Post #1





Grupa: Zarejestrowani
Postów: 535
Pomógł: 27
Dołączył: 3.05.2005

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


Witam

Do tworzenia miniatur na stronie urzywam tego skryptu:


Kod
<?php
// The file
$filename = 'pliki/zdjecia/'.$kat.'/'.$id.'.jpg';

// Set a maximum height and width
$width = 100;
$height = 100;

// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);

if ($width && ($width_orig < $height_orig)) {
  $width = ($height / $height_orig) * $width_orig;
} else {
  $height = ($width / $width_orig) * $height_orig;
}

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

// Output
imagejpeg($image_p, null, 100);
?>



Skrypt w pliku 1.php gdzie jest tylko on działa jednak po wrzuceniu an strone nie pokazuje sie obrazek tylko wywala takie coś:


Kod
Warning: Cannot modify header information - headers already sent by (output started at d:\usr\apache\httpd\html\a\tapeta.php:7) in d:\usr\apache\httpd\html\a\tapeta.php on line 98
˙Ř˙ŕÉywşu’ŐŇÜĹ^Ű\EćXJżb1tiUĄR•yâ0XÚÄaĽ SQĽ(Şľ(ĹÉÍş5$ŠŐ‹Q—2´ăŚ˙+d´–mĂ;œ9lې=;ädŕőŻÓŮźEâ9 ľéöń5ŢŁyhŹ^ÖÖ#‘$’ĺXŁ•Ú(K-–,¤šuâYáž§;ĆńŠçŇŇé˘ÖV÷ôIhŰM;O Dq0~ŇŁćşv”ßis_źUßUe˝ľ+üBń6ŁK{ŤÜÁ4Z|Â}6ęÖÉ.‘RÚˆ –#IDŚ0— ˛¤rÇx÷c43ÄĂăŢÍŹ_Î%˝ytŰ#ćĎ<ÖihĆœ˛¨@ťB–$üČŔ’AM§é:ş˝ľƒÂÚ{ –ĺ-‡›¨[ó\°3ÜÝ:…‚ĺ™Ár_tjŒ…-řŰKż–é|9¤ÂÎ ýnč9-sőĚPŰB¤ŢS<ŞĹ\n‘a,ߛaŁĽH”Ű~ÍǕľ8ŮśţÓM'—5–ČűŠŐ'U7NٚI9ť?zúEZÚ´Ów},֍žiiĽ_xę}Q`Xź7¤>Č ńŹPJTœË&÷ź•c,AŤG$‚Ľř†˙ÍŞk:–vV˛‡›JՅą{IdňĎyk††9ŕ śŇ: ¨ËŔëó˙gÎÇÚ




Skrypt pobiera zmienne z adresu. Z góry będe wdzięczny za pomoc bo już nie wiem co zrobić (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) .Ewentualnie podać mi jakiś inny podobny kod do tworzenia miniatur.

Ten post edytował nospor 1.05.2006, 18:25:17
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
wlamywacz
post
Post #2





Grupa: Zarejestrowani
Postów: 535
Pomógł: 27
Dołączył: 3.05.2005

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


Dam tylko php
  1. <?php 
  2. $pliki=glob('pliki/zdjecia/'.$kat.'/*.jpg'); 
  3. $count=count($pliki); 
  4. echo 'Liczba plikow: ' . $count;
  5.  
  6.  
  7. echo '<bR><bR>';
  8.  
  9. $przod = $id + 1;
  10. $wstecz = $id - 1;
  11. $najw = $count - 1;
  12. ("<img border=0 src=pliki/zdjecia/tapeta.jpg?kat=$kat&id=$id alt=Śmieszne zdjęcia - www.smieszny.info><bR><bR>");
  13.  
  14. if($id <= $najw)
  15. echo("<a href=tapeta-$przod-$kat.html>Następne</a><br>");
  16.  
  17. if($id >= 1)
  18. echo("<a href=tapeta-$wstecz-$kat.html>Poprzednie</a><br>");
  19.  
  20. // The file
  21. $filename = 'pliki/zdjecia/'.$kat.'/'.$id.'.jpg';
  22.  
  23. // Set a maximum height and width
  24. $width = 100;
  25. $height = 100;
  26.  
  27. // Content type
  28. header('Content-type: image/jpeg');
  29.  
  30. // Get new dimensions
  31. list($width_orig, $height_orig) = getimagesize($filename);
  32.  
  33. if ($width && ($width_orig < $height_orig)) {
  34.  $width = ($height / $height_orig) * $width_orig;
  35. } else {
  36.  $height = ($width / $width_orig) * $height_orig;
  37. }
  38.  
  39. // Resample
  40. $image_p = imagecreatetruecolor($width, $height);
  41. $image = imagecreatefromjpeg($filename);
  42. imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
  43.  
  44. // Output
  45. imagejpeg($image_p, null, 100);
  46. ?>
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: 10.10.2025 - 23:26