Resize an image's height in a table according to content

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
arrr_matey
Forum Newbie
Posts: 2
Joined: Fri Mar 13, 2009 12:08 am

Resize an image's height in a table according to content

Post by arrr_matey »

Hi everyone, this looks like a great forum for getting some assistance on my newly started adventures in PHP... look forward to talking with you all...

I have a problem I'm hoping PHP can fix:

I have a script that will put a block of text into a table cell from a database. And I am using three image files as a border on the top, right and bottom of the table cell that has the text. The width of the table is always the same, so the images for the top and bottom never have to change. But the image that runs along the right of the text has to stretch so it's the same height as the cell with the text (it's just a line with a drop-shadow, so it doesn't distort when stretched).

My question is this: is there a way using PHP to make the right-side image automatically match the height of the text cell, when the height of the text cell varies?

If anyone can help, I'd appreciate it a ton. Maybe tables isn't the right way to do this?

Cheers
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Resize an image's height in a table according to content

Post by requinix »

CSS 3 will make things easier, but until then you can use the repeat-y property of background images.

Three images to form the top and width of the table. The height will expand automatically.
Then three columns in the body: left and right are empty with a background image (repeated along the height) and the middle is where stuff goes.


Whether using tables for this is right or wrong is debatable. I'd prefer CSS, but there's a great simplicity that a table can provide that CSS cannot - yet.
arrr_matey
Forum Newbie
Posts: 2
Joined: Fri Mar 13, 2009 12:08 am

Re: Resize an image's height in a table according to content

Post by arrr_matey »

I forgot to post a thank you, but this worked very well...

so thanks!!!
Post Reply