Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> rozmiar obrazka
blizniak
post
Post #1





Grupa: Zarejestrowani
Postów: 253
Pomógł: 0
Dołączył: 14.04.2005

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


Witam wiem ze ten temat byl juz wiele razy ale czy moglby ktos powiedziec co jest zle w moim skrypcie
  1. <?php
  2. function resizeImage($filename, $newwidth, $newheight){
  3.  
  4. list($width, $height) = getimagesize($filename);
  5.  
  6. //echo $_FILES['src']['error'];
  7. $thumb = imagecreate($newwidth, $newheight);
  8. $source = imagecreatefromjpeg($filename);
  9.  
  10. imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
  11.  
  12. return imagejpeg($thumb);
  13.  
  14. }
  15. ?>


  1. <?php
  2.  if( is_uploaded_file( $_FILES['src']['tmp_name'] ) )
  3. {
  4.  
  5. $strUploadDir = 'images/' . $_FILES['src']['name'];
  6. echo $_FILES['src']['name'];
  7. $my_image = resizeImage($_FILES['src']['tmp_name'], &#092;"200\", \"200\");
  8.  
  9. if( move_uploaded_file( $my_image, $strUploadDir ) )
  10. {
  11.  
  12. $zapytanie=mysql_query(&#092;"INSERT INTO sprzedarz SET 
  13. zdjecie='\".$strUploadDir.\"' &#092;");  
  14.  
  15.  
  16. if(!$zapytanie)
  17.  {
  18. echo &#092;"blad\"; print mysql_error();
  19.  }
  20. //echo 'Plik został pomyślnie uploadowany! <br />';
  21.  include 'wyswietl_wszystko.php';
  22. }
  23. else
  24. {
  25.  
  26. echo 'Upload pliku nie powiódł się!';
  27. echo 'Dodatkowe informacje o uploadowanym pliku: <pre>' . print_r( $_FILES, true ) . '</pre>';
  28. }
  29.  
  30. }
  31. else
  32.  {
  33. echo 'Wystapil blad podczas wysylania pliku na serwer!';
  34.  }
  35. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
blizniak
post
Post #2





Grupa: Zarejestrowani
Postów: 253
Pomógł: 0
Dołączył: 14.04.2005

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


dodalem to header tak
  1. <?php
  2.  
  3. function resizeImage($filename, $newwidth, $newheight){
  4. header(&#092;"Content-type: image/jpeg\");
  5. list($width, $height) = getimagesize($filename);
  6.  
  7. //echo $_FILES['src']['error'];
  8. $thumb = imagecreate($newwidth, $newheight);
  9. $source = imagecreatefromjpeg($filename);
  10.  
  11. imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
  12.  
  13. return imagejpeg($thumb);
  14.  
  15. }
  16.  
  17. ?>

ale to i tak nic nie daje bo gdy dojdzie do tej linijki header to w przegladarce pokazuje jakis obrazek ktorego nie widac, tylko pisze ze tam powinien byc obrazek

Ten post edytował blizniak 2.08.2005, 10:37:57
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: 7.10.2025 - 10:31