Resize a background image of a cell

I have a cell that I put a background image in. This is all dynamic so I can not just change the image size so I need to do it thru HTML, CSS, ASP or JS. When the image is smaller then the cell I am really not having a problem because I have CSS to make it not tile.
redbrad0Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

imnajamCommented:
Hi redbrad0,

I don't exactly get what you are looking for but just a suggestion that might help you <img src="img.jpg" width="100%" height="100%"> this will always force the image to stretch according to the table cell

Cheers!
0
redbrad0Author Commented:
No I am adding the image as the background of the cell. This way when I can add a transparent image in the cell so if you try and right click to download the image you will get the transparent image. In the example below you can kind of see what I am doing. the image.gif in the cell background I would like specify the size of image that is the background to the same size at what the cell is.

<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="200" width="200" background="image.gif"><img src="transparent.gif" border="0"></td>
  </tr>
</table>
0
seanpowellCommented:
You'll need to dynamically adjust the image size with js, as html and css can't control background image dimensions.
But the image is still readily available so it probably won't be worth the effort...

Sean
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

GarveCommented:
You can fix the position of a background image to a corner of the container or tile it, but I don't think you are able to stretch or resize it.

To do what you want you will need to lay two divs, one on top of the other, each with an image in it.
0
redbrad0Author Commented:
Is there a way to set the div inside the cell no matter where it is on the page or do I have to set the positions of the x, y cordinates of the div images.
0
COBOLdinosaurCommented:
It is unbelievable that there are still some who think they can prevent grabbing and image, but it is sometime quite entertaining to watch the pages get made even more defective as they attempt work with the broken structures they have created trying to protect their images.  The transparent image trick is like putting a big lock on the fron door of a house with no walls.

So now you have created an impossible situation where you are going to be forces to degrade the presentation of the images so they can be secure from teh 2% of users who don't know how to get around the trick.

Backgrounds cannot be made to size dynamically.  Containers cannot be size to the background dimensions unless you know the size and set the container to explicit values.  At some point you should probably do an audit to see how much of your time you have wasted on this futile effort to protect your images.

Cd&
0
redbrad0Author Commented:
I am a programer and asked by one of my clients to do this and is paying me for my time. I know it does not stop everyone but that was not my question. My question is how to do it not should it be done. So how about we stick to answering the question.

0
COBOLdinosaurCommented:
>>> So how about we stick to answering the question

That is exactly what has been done.

You wanted to re-size a background image.  You now know that cannot be done.   You have also been given the option of layering images with absolute position (which has very little hope of working without creating a very rigid structure.

Finally it has been pointed out that the problem is because of the design mistake (imposed by your client, but nonetheless a mistake) which now make it difficult to resolve anything without creating more problems.

Cd&
0
redbrad0Author Commented:
Just close the stupid question and when I have questions I will find another site that where the moderators are slamming members and when the members respond they get there message deleting but the moderator doesnt because they think they are god and can do whatever they want
0
redbrad0Author Commented:
Please close this question.
0
redbrad0Author Commented:
And why? Did anyone answer my question? COBOL should not get any points what so ever basically degrading me and the item I am asking. I asked a long time ago just for the points to be refunded.
0
redbrad0Author Commented:
fine whatever just give them the points.... what ever the powers to be have to do but COBOL should not get any points for all he did was slam me and the idea. When a customer ask's you to do something then that's what you have to do.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.