-
Improvement
-
Resolution: Won't Fix
-
Minor
-
None
-
None
After tracking down a recent problem with my forum, which turned out to be a problem with getimagesize(), I was surprised to find that image dimensions are fetched every time that an attachment is viewed in a topic, private message etc., which seems like a fairly costly way to do it.
Basically what I'm proposing is that two new columns be added to the attachments table, one for width and one for height, both supporting NULL values (the default). When an image/flash attachment is viewed for the first time these values will be NULL, prompting phpBB to call getimagesize() as it does now, however the values returned will then be stored back to the attachments table (unless getimagesize() fails by returning FALSE).
This way an image attachment's actual size need only be fetched once, at which point the only processing is in deciding whether this exceeds the maximum. Of course there is also the issue of thumbnails, however I believe that this can be worked out from the image's cache dimensions when compared against the board's settings? This would be to try and avoid needing another set of width/height values.
Anyway, this has a useful side-benefit, specifically the implementation of specified image sizes during upload, i.e - when a user uploads an image attachment they could specify the size it should be displayed at. Basically the aim though is to cut down on having to call getimagesize() all the time, since it has to open up at least some of the file in order to get the values it needs, so on an image attachment heavy board disk access could be quite high for each page-view, and that's in addition to the actual serving of the content ![]()

