Q&A

Q1: Are there any performance issues with regard to dynamic images?
A1: A dynamically created image is slower to arrive at the browser than an image that already exists. Depending on the efficiency of your script, the impact is not likely to be noticeable to the user if you use dynamic images sparingly.

Remember that functions such as imagepng() and imagejpeg() accept an optional path argument that causes the image to be written to a file. You can use this to cache your dynamic images, changing them only when the information they present changes.

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.