Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Problem ze zmienianiem rozmiaru obrazka
renault12
post
Post #1





Grupa: Zarejestrowani
Postów: 147
Pomógł: 0
Dołączył: 9.01.2010

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


Tak jak w temacie mam mały problem dotyczący zmieniania rozmiarów obrazka. Przy kodzie występuję błąd w takiej postaci:


  1. Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home/tomstoys/public_html/resizer.php on line 34
  2. questionmark.gifquestionmark.gif?JFIF?questionmark.gif?questionmark.gifquestionmark.gif?>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), d
  3. efault quality questionmark.gif?C?   


Plik który wrzucam to jpg

A to jest kod:
  1. <?
  2. if (isset($_POST['wyslij'])) {
  3. $szer = $_POST['szer'];
  4. $wys = $_POST['wys'];
  5. $file = $_FILES['obraz'];
  6. $filesize = $file['size'];
  7. $filename = "obrazy/" . $file['name'];
  8. move_uploaded_file($_FILES["obraz"]["tmp_name"],
  9. "obrazy/" . $_FILES["obraz"]["name"]);
  10. $typ = "obrazy/" . $_FILES['obraz']['type'];
  11. if ($typ == "image/jpeg") {
  12. $source_id = imagecreatefromjpeg("obrazy/" . $_FILES["obraz"]["name"]);
  13. }
  14. if ($typ == "image/png") {
  15. $source_id = imagecreatefrompng("obrazy/" . $_FILES["obraz"]["name"]);
  16. }
  17. if ($typ == "image/gif") {
  18. $source_id = imagecreatefromgif("obrazy/" . $_FILES["obraz"]["name"]);
  19. }
  20. if ($typ == "image/bmp") {
  21. $source_id = imagecreatefromwbmp("obrazy/" . $_FILES["obraz"]["name"]);
  22. }
  23. list($szerokosc, $wysokosc) = getimagesize($filename);
  24. $thumb = imagecreatetruecolor($szer, $wys);
  25. $target_pic = imagecopyresized($thumb, $source_id, 0, 0, 0, 0, $szer, $wys, $szerokosc, $wysokosc);
  26. imagejpeg($thumb);
  27. }
  28. ?>


Ktoś bystry mógłby coś poradzić smile.gif?

Ten post edytował renault12 14.06.2010, 16:35:29
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 21.08.2025 - 03:28