PHP question...
- Started
- Last post
- 11 Responses
- gabriel2
Is there an advantage to storing uploaded image widths and heights in mysql as opposed to reading the image sizes inline using getimagesize()?
it's only going to be one image per page...
Thanks!
- fusionpixel0
I have used no dimensions in the actual page and I have seen other sites do that with no problem.
yknow just doing:
img="blah.jpg" border=0
with no extra tags
- gabriel20
I prefer to have the image dimensions within the html to avoid having the page jump in size as the images loaded...
- zackgilbert0
yeah. storing the image dimensions in a database as well seems to be overkill. i imagine it would take longer to load as well. i wouldn't bother.
- enobrev0
actually it's the opposite. Since you're probably grabbing the filename from a database anyways, including dimensions will cost nothing, and definitely less than running a function that checks the binary file for image dimensions.
Although the differnece is so minimal, it doesn't matter much, unless you're talking extremely high traffic or 1000's of pics at a time.
- zackgilbert0
just seems like its a waste to take up for db space, though may be small, could add up.
but i do see what you're saying, if you're grabbing the info from the db anyways.
- enobrev0
the 2 integer columns in the db are incredibly minimal. Not even worth counting. Consider the technical 'size' of the letter 'a' on a hard drive.
- cvirus0
the standards-purists say all attributes (height, width, border), should be controlled with CSS and not marked up in XHTML. so they say...
- enobrev0
well you could still do a "style="width: $width; height=" $height", but i think the point of having the img tag attributes is to ensure the redraw in the browser isn't all mucked up.
- Roshambo0
Enobrev is right, the image and height attributes just help the page render itself in a clean fashion.
Listen to Enobrev. He's the man.
- enobrev0
Roshambo!!
Happy New Year!
- Roshambo0
Hey, Enobrev! Happy New Year to you too, man.