?
Solved

Resize a background image of a cell

Posted on 2004-11-17
17
Medium Priority
?
200 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:redbrad0
12 Comments
 
LVL 9

Expert Comment

by:imnajam
ID: 12612296
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
 

Author Comment

by:redbrad0
ID: 12614240
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
 
LVL 31

Accepted Solution

by:
seanpowell earned 172 total points
ID: 12616635
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Assisted Solution

by:Garve
Garve earned 164 total points
ID: 12616646
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
 

Author Comment

by:redbrad0
ID: 12617184
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
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 164 total points
ID: 12617371
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
 

Author Comment

by:redbrad0
ID: 12618120
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12618702
>>> 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
 

Author Comment

by:redbrad0
ID: 12619775
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
 

Author Comment

by:redbrad0
ID: 13170354
Please close this question.
0
 

Author Comment

by:redbrad0
ID: 13524370
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
 

Author Comment

by:redbrad0
ID: 13526573
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question