Jump to content

problem with table background image


MDanz

Recommended Posts

i swear i've done this correctly but its not working.

 

$imagelocation = $row_data['imagelocation'];

$image = "<img src='$imagelocation' width='144px' height='100px'>";

 

when i do this and then echo $image, it works.

 

now when i try to input it in here as background... the VALIGN= middle part shows instead of the $image.

 

<td width='147px' height='110px' background='$image' VALIGN='middle'>

 

:wtf:

 

Link to comment
https://forums.phpfreaks.com/topic/172942-problem-with-table-background-image/
Share on other sites

Hi MDanz,

 

If:

 

$image = "<img src='$imagelocation' width='144px' height='100px'>";

 

Then you're essentially saying:

 

<td width='147px' height='110px' background='<img src='$imagelocation' width='144px' height='100px'>' VALIGN='middle'>

 

Which wouldn't work.  Give the following a try:

 

<td width='147px' height='110px' background='$imagelocation' VALIGN='middle'>

yeh that works but doesn't resize..

 

 

when i do the "<img src='$imagelocation' width='144px' height='100px'>" it actually resizes the image to that size..

 

if using $imagelocation is the only way to do this, how do i get it to resize the image to those dimensions(144,100px)?

Hi MDanz,

 

You can't resize an image on a td background.  You could use CSS to change repeat settings and the location, or perhaps there is a Javascript function that would resize a td background image?

 

Would the below do what you need?

 

<td width='147px' height='110px' VALIGN='middle'>'$image'</td>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.