Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Allowed memory size of 8388608 bytes exhausted
KCG
post
Post #1





Grupa: Zarejestrowani
Postów: 449
Pomógł: 4
Dołączył: 1.12.2006

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


Przy dodawaniu zdjęcia mam taki błąd:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 5200 bytes) in D:\users\trudny\motocykl\o_czesci.php on line 136
Zwiększyłem ini_set() limit pamięci na około 50MB. Na lokalnym tego nie mam.
Kod:
  1. <?php
  2. $image_name = imagecreatefromjpeg($img);
  3. $getimg = getimagesize($img);
  4. list($width,$height) = $getimg;
  5. $image = imagecreatetruecolor($width,$height);
  6. imagecopyresampled($image,$image_name,0,0,0,0,$width,$height,$width,$height);
  7. imagejpeg($image,$img);
  8. imagedestroy($image);
  9.  
  10. //watermark
  11. $getimg = getimagesize($img);
  12. list($width,$height) = $getimg;
  13. $water_src = 'images/znak_wodny.png';
  14. $watermark = imagecreatefrompng($water_src);
  15. list($wwidth,$wheight) = getimagesize($water_src);
  16. $image = imagecreatetruecolor($width,$height);
  17. imagecopyresampled($image,$image_name,0,0,0,0,$width,$height,$width,$height);
  18. imagecopy($image,$watermark,10,10,0,0,$wwidth,$wheight);
  19. imagejpeg($image,$img);
  20. imagedestroy($image);
  21.  
  22. //thumb
  23. $imageThumbName = $imgName.'t.jpg';
  24. $widthT = 100;
  25. $heightT = $widthT/$width*$height;
  26. $imageThumb = imagecreatetruecolor($widthT,$heightT);
  27. $image_name = imagecreatefromjpeg($img);
  28. imagecopyresampled($imageThumb,$image_name,0,0,0,0,$widthT,$heightT,$width,$height);
  29. imagejpeg($imageThumb,'images/gielda/moto/'.$imageThumbName);
  30. //new thumb
  31. imagedestroy($imageThumb);
  32. imagedestroy($image_name);
  33. $imgThumbName = $imgName.'tt.jpg';
  34. $imgt = imagecreatefromjpeg($img);
  35. $imgTH = 140;
  36. $imgTW = $imgTH/$height*$width;
  37. $srcX = ($imgTW-100)/2;
  38. $imgT = imagecreatetruecolor($imgTW,$imgTH);
  39. imagecopyresampled($imgT,$imgt,0,0,0,0,$imgTW,$imgTH,$width,$height);
  40. imagedestroy($imgt);
  41. $imgT2 = imagecreatetruecolor(100,140);
  42. imagecopymerge($imgT2,$imgT,0,0,$srcX,0,$imgTW,$imgTH,100);
  43.  imagejpeg($imgT2,'images/gielda/moto/'.$imgThumbName);
  44.  imagedestroy($imgT2);
  45. imagedestroy($imgT);
  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: 23.08.2025 - 14:06