The problem is this. This thing for PHP is definitely a pit.
Traffic up, the image source station is not stable, network problems, minutes to kill the server.
Can ask the front-end great God there is no plan, or compromise method.
If not, you can build a table in the database to maintain a picture information data.
Then when there is a picture to join, the first to determine whether the table has data, if not to get the size of the picture into the table, and then do the back operation.
When the page is displayed, look it up directly.
Here does not say cache, do not say the queue, do not say the picture localization (instead of using his station picture), because it seems that these will greatly increase the complexity, when necessary to reconsider.
V2 There is no great God in the station has proposed a solution?
Http://v2ex.com/t/286977#reply17
Getimageinfo try it.
GetImageSize time is too long, probably because your bandwidth is too low, or the picture server slow response speed caused by
I copied a comment.
GetImageSize
As noted below, getimagesize would download the entire image before it checks for the requested information. This was extremely slow on large images that was accessed remotely. Since the Width/height is in the first few bytes of the file, there are no need to download the entire file. I wrote a function to get the size of a JPEG by streaming bytes until the proper data are found to report the width and Hei Ght: