A fail-safe way to prevent GD image library from running out of memory? (PHP)

前端 未结 6 1485
礼貌的吻别
礼貌的吻别 2020-12-31 20:01

Is there a way to prevent the PHP GD image library from running out of memory? If too large an image is uploaded, GD tends to run out of memory, terminating the script. I\'d

6条回答
  •  一个人的身影
    2020-12-31 20:46

    Buy more memory! :-P

    Seriously though, it is impossible to handle being out of memory because any action you take would require more memory.

    Your best bet is to limit the size of image being uploaded based on the current memory settings.

提交回复
热议问题