Skip to content
Archive of posts tagged image

Memory Usage in PHP GD Image Functions

When working with the PHP GD Image functions, memory usage can become a serious issue. Where PHP developers often stumble is in not realizing that the various imagecreate*() functions create a bitmap in memory with data for each and every pixel. Therefore a source JPEG file that is only a few tens of kilobytes in [...]

Securing Uploaded Image Files

I just saw this post by “jazz_snob” posted at PHPBuilder.com, suggesting a means to secure untrusted image files. The basic idea is to use PHP’s GD image functions to create a copy of the file. As doing so would decompose the specified file into GD’s native bitmap format, and then recompose it into the desired [...]