Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Problem z imagecreatefromjpeg
MONII28
post 18.07.2008, 16:09:59
Post #1





Grupa: Zarejestrowani
Postów: 65
Pomógł: 1
Dołączył: 10.01.2008
Skąd: małopolska

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


Mam błąd Fatal error: Call to undefined function: imagecreatefromjpeg() in c:\program files\easyphp1-8\www\image.php on line 54
  1. <?php
  2.  
  3. $link = mysql_connect( "localhost", "xxx", "xxx")
  4. or die("Nie mogę się połączyć: " . mysql_error());
  5. mysql_select_db("meble",$link)
  6. or die (mysql_error());
  7.  
  8. $opis = $_POST['opis'];
  9. $zdjecie = $_FILES['zdjecie']['name'];
  10. $today = date("Y-m-d");
  11.  
  12. $ImageDir ="C:/Program Files/EasyPHP1-8/www/zdjecia/";
  13. $ImageThumb = $ImageDir . "thumbs/";
  14. $ImageName = $ImageDir . $zdjecie;
  15. if(move_uploaded_file($_FILES['zdjecie']['tmp_name'], $ImageName)){
  16. list($width, $height, $type, $attr) = getimagesize($ImageName);
  17. if ($type > 3) {
  18. echo "Przesłany obraz nie jest w formacie GIF , JPG lub PNG.<br>";
  19. } else {
  20. $insert = "INSERT INTO realizacje
  21. (opis, zdjecie, data)
  22. VALUES
  23. ('$opis', '$zdjecie', '$today')";
  24. $insertresults = mysql_query($insert)
  25. or die(mysql_error());
  26. $lastpicid = mysql_insert_id();
  27. $newfilename = $ImageDir .$lastpicid . ".jpg";
  28. if ($type == 2){
  29. rename($ImageName, $newfilename);
  30. } else {
  31. if ($type == 1) {
  32. $image_old = imagecreatefromgif($ImageName);
  33. } elseif ($type == 3) {
  34. $image_old = imagecreatefrompng($ImageName);
  35. }
  36. $image_jpg = imagecreatetruecolor($width, $height);
  37. imagecopyresampled($image_jpg, $image_old, 0, 0, 0, 0,
  38. $width, $height, $width, $height);
  39. imagejpeg($image_jpg, $newfilename);
  40. imagedestroy($image_old);
  41. imagedestroy($image_jpg);
  42.  
  43. }
  44. $newthumbname = $ImageThumb . $lastpicid . ".jpg";
  45. $thumb_width = $width * 0.10;
  46. $thumb_height = $height * 0.10;
  47. $largeimage = imagecreatefromjpeg($newfilename);
  48. $thumb =imagecreatetruecolor($thumb_width, $thumb_height);
  49. imagecopyresampled($thumb, $largeimage, 0, 0, 0, 0,
  50. $thumb_width, $thumb_height, $thumb_width, $thumb_height);
  51. imagejpeg($thumb, $newthumbname);
  52. imagedestroy($largeimage);
  53. imagedestroy($thumb);
  54. $url= "location: showimage.php?id=" . $lastpicid;
  55. header($url);
  56. }
  57. }
  58.  
  59.  
  60.  
  61.  
  62. ?>


Dlaczego?
Go to the top of the page
+Quote Post
Xniver
post 18.07.2008, 16:10:33
Post #2





Grupa: Zarejestrowani
Postów: 108
Pomógł: 26
Dołączył: 29.02.2008

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


Na serwerze nie ma biblioteki GD2
Go to the top of the page
+Quote Post
MONII28
post 18.07.2008, 16:12:13
Post #3





Grupa: Zarejestrowani
Postów: 65
Pomógł: 1
Dołączył: 10.01.2008
Skąd: małopolska

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


Jak to zmienić aby działało?
Go to the top of the page
+Quote Post
Hazel
post 18.07.2008, 16:52:26
Post #4





Grupa: Zarejestrowani
Postów: 492
Pomógł: 33
Dołączył: 16.08.2007
Skąd: Wrocław

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


Na początek w pliku php.ini odkomentuj linię ;extension=php_gd2.dll (usuń z niej średnik na początku).

Ten post edytował Hazel 18.07.2008, 16:54:29


--------------------
Go to the top of the page
+Quote Post
--MONII28--
post 19.07.2008, 12:37:04
Post #5





Goście







Wysłałam stronę na serwer freens.pl. Wcześniej na lokalnym serwerze działało mi zapisanie zdjęcia do pliku a teraz nie działa podejrzewam że źle wpisuje ścieżkę do pliku na serwerze freens
  1. <?php
  2. $ImageDir ="/public_html/zdjecia/";
  3. ?>
Jak mam wpisać , co mam źle. http://www.meblenawymiar.freens.pl/
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 5.07.2025 - 03:14