[thelist] php/MySQL, images and valid HTML output...

John Corry webshot at neoncowboy.com
Wed Mar 28 11:18:36 CST 2001


I just wanted to ask how you guys approach this:

Say you are creating a bunch of pages from content stored in a MySQL db.
Some of the content (or even most of it) is images. To output valid HTML you
have to include height and width attributes in the img tag.

In my example, I'm storing paths to the images that I can retrieve to write
into the src attribute of the img tag. My best thought is to also store the
h & w values, and write them into their appropriate attributes. Is there a
better way?

I briefly considered the remote possibility that one might use the db
content to create image objects, rather than img tags...and then use JS to
write the tags...and generate the h & w attributes on the fly, but that
seemed way to complicated and daunting when compared to just putting the h &
w in the db.

thanks,
John Corry





More information about the thelist mailing list