Reputation:
What is the optimal way to store an image dimension in a database? Should I just use two SMALLINTs? Or should I use a POINT or a VARCHAR?
Upvotes: 2
Views: 1220
Reputation: 1373
Depends on what you need this data for. If you are going to run SELECT
s based on image size, then SMALLINT for each (width, height). If you just need image dimensions as meta data to the image, you can use varchar with serialized array (for example returned by getimagesize()) or string.
Hope that helps. :)
Upvotes: 4
Reputation: 8615
Speaking optimally, clearly the least amount of storage required to hold any values you want stored would be best. I don't have a lot to add to what you already know: I think two SMALLINT
s would be the best route to go.
Upvotes: 5