...

View Full Version : adjusting the size of a background image



joonstar
04-15-2004, 01:05 AM
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100" height="100" background="test.gif"></td>
</tr>
</table>


I have the above code.

The size of the test.gif can be 120*150, 140*110 or others.
I like to make the test.gif to be shown as 100*100 regardless of its original size.

The following code can adjust image size.

<img src="test.gif" width="100" height="100">

But I like to adjust it as a background image.

Thank you very much

Antoniohawk
04-15-2004, 02:34 AM
I'm pretty sure that you can't adjust the size of a background image.

bradyj
04-15-2004, 02:34 AM
I don't think you can adjust the size of a background image. It only goes by your original size.

mindlessLemming
04-15-2004, 03:22 AM
You'll have to wait for CSS3 before you can do that.... See you in 10 years when there's some decent browser support :(

I EAT TUMORS
04-15-2004, 03:55 AM
Yeah you are stuck editing the size through a image editor of some kind

l3vi
04-15-2004, 04:14 AM
Ive asked this question b4. Its annoying. Just resize your image to 5000 x 5000 (or somewhat close) in an image editor. And then set it as your bg. It will resize to fit your browser size perfect :D

me'
04-15-2004, 10:57 AM
Ive asked this question b4. Its annoying. Just resize your image to 5000 x 5000 (or somewhat close) in an image editor. And then set it as your bg. It will resize to fit your browser size perfect :DBut you'll have to wait hours for the 25 megapixels to download!

bazz
04-15-2004, 01:39 PM
Well this may not be correct for all types of browser but:

If your are building your site to take account of resolution settings of 1024 x768 and 800 x 600 (possibly 640x480) they are sized in a proportion of 4:3 eg 400px X 300px like a normel UK television.

so you could make an image in your image editor thats a bit smaller than 800x600 (I've misplaced the actual dimensions - which are variable anyway due to the different configurations ppl use at the top) and, cut and paste it to a larger plain image that would overfill your browser window. This would give you your background in its correct proportion and with a border around it so that it doesn't repeat within the window.

Then for those at 1024 x 768, your image would be the same and the background too, but the border would appear bigger and the image should still be centered if your use the existing css2.

Alternatively, you might find a Javascript that enables you to have two images and the browser determined which one is produced depending on the settings of the individual user. (might take a cookie - dunno about them yet).

Bazz

joonstar
04-28-2004, 03:53 PM
<td style="background: url(test.gif); height: 100px; width: 100px;"></td>


The above code will show the test.gif as a background image.

Although the size of the original image is 300*300, the above code make it
100*100.

But it has one problem, i.e. it shows only one third of the image.

For example,
if it is the image of my face, it shows only my right hairs and forehead.
it doesn't show my nose, lips and chin.

I like to show my whole face including left hairs, left forehead, eyes, nose, lips, and chin as a background image with adjusting the size into 100*100 from the original size 300*300.


Is there no way to do this?
I am still hunger for finding this.

Thanks in Advance

bradyj
04-28-2004, 05:27 PM
I believe all you did was clip the image -- and again, all you can do is:
1. Edit it in an image editor for the appropriate size or
2. Use javascript to load a specific background depending on size or
3. use CSS3 which has minimal support

joonstar
04-29-2004, 12:11 AM
Thanks for your answering, bradyj



I believe all you did was clip the image -- and again, all you can do is:


I don't understand what "clip" means in your sentence.
Would you please rephrase the sentence?



1. Edit it in an image editor for the appropriate size or

The image will not be made by me.
The image will posted by users.

Users will post various size images.
I like to fix it 100*100 regardless of the orignal size of the every image.
This means I can't edit the every image whenever it posted.




2. Use javascript to load a specific background depending on size or

Do you mean I should post this in javascript forum?



3. use CSS3 which has minimal support

What is the CSS3?

Thanks in Advance

bradyj
04-29-2004, 12:25 AM
Clip -- kind of a print graphics term (different than the css version of clip, but same idea http://www.w3schools.com/css/pr_pos_clip.asp) Meaning, the whole graphic is loaded fully, but some of it is "clipped" or cut off.
That could be useful for you.

I'm sorry, I didn't catch that other users were loading it until now -- maybe this could be accomplished with a server-side script then, since users are loading it. Maybe someone knows of some PHP that can help?

...and the javascript statement was that you can have custom size images load on a browser size basis. I was still thinking you only needed one image with multiple sizes, that's out.

CSS3 = The WWW guys come out with updates to all the codes every few years - right now most of us are using Cascading Style Sheets 2 and 2.1 -- but there is a version Cascading Style Sheets 3 (CSS3) that's in the works. This upgrade will allow you to do what you're talking about -- have a fixed size for the background images in your webpage regardless of the actual file size. However, this is not supported by current browsers (well, some) and not recommended. You'd have to wait a while for this one.

joonstar
04-29-2004, 12:35 AM
They are all useful informations for me. Thanks.

I have one more question.
This is just from curiousity.



Art is what you can get away with.


It seems something but I don't understand it fully.
Would you rephrase it a little more easy if you don't mind?(I am not a native speaker of English)

bradyj
04-29-2004, 03:38 AM
This is off topic, but I think it's useful design information, and has helped me in my design work, If there is a problem with answering this question, I apologize, but I thought it would be good for others to listen in, if they are interested in learning more about art and design (especially andy warhol who's pop art inspires much print... and a lot of web too):

<offtopic>
Andy Warhol used to joke that America was all about the consumer -- that we were machines living in a country built on rolling everything off the factory as fast as you can. Since we are a close-minded culture, some things are too extreme until a few more generations, and then they are no longer too extreme, and something else takes it's place. So the term 'Art is what you can get away with' -- is really saying that Art at this current moment in the American culture are thoughts, designs, and ideas that break the rules of what we think are comfortable thoughts, designs, and ideas.

An example:
If I were to take a photograph of the war in Iraq that showed a lot of violence (bodies, blood, warfare) -- would you think it was artistic or would you think it was gruesome trash? Depending on what the picture looks like, it just might be unique enough to be called art to you -- but if it was not, you may not think it's art. It depends on 'what I can get away with', like a child trying to pull as many pranks he can before his parents catch him.

Mark Kostabi (http://www.markkostabi.com/) believes in this statement -- he used to paint and design his own work... but in the late 80's, decided to pay students to paint his ideas and he just signs it... in the 90's, he decided to pay people to think up his paintings AND paint them. This is a long debate we can hold in another forum - but the idea is that he's walking a thin line of what old ideas about art he can break, and to some, he's doing it. He's creating art.
</offtopic>

joonstar
04-29-2004, 06:48 AM
I was just asking what is the literal meaning of the sentence.

But you talked long story.

Although I don't get the literal meaning of the sentence clealy yet,
I could follow your sentence. And I feel art.

It doesn't matter whether I understand the literal meaning of the sentence but It does actually matter what I felt by your paragraph because Art is what I feel, not what I understand .

I feel Andy meant something not accustomed with although I didn't have any clue who was Andy until today morning.

For example,

If I were to take a photograph of the war in Iraq that showed a lot of violence i.e. western photographers, American women soildier( I don't remember her name) captured or killed by the, so called, terrorists,
I would produce the tons of propogander trash like things the CNN produces everyday.
On the contrary,
If I might take picture of the terrors which are making in the name of anti-terror war everyday to powerless and hopeless people who are not cared by any photographers, that would be what I can get away with...

bazz
04-29-2004, 02:28 PM
I found this script lurking in my HDD. You might find it helps in the meantime - ie until you find a better one but, it may do what you want. I havent looked at it in anything other than IE6 and in it, it was OK for what I wanted.

<SCRIPT LANGUAGE="JavaScript1.2">

/*
Watermark Backgound Image Script- Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS,
visit dynamicdrive.com
*/

if (document.all||document.getElementById)
document.body.style.background="url('images/ImageFileName.jpg') white center no-repeat fixed"

</SCRIPT>


EDIT: Just checked. It works in Moz too :)

coder_seth
04-29-2004, 07:26 PM
People like Andy Warhol and that Mark guy are also just pretentious (but with intelligence and dignity) punks that abuse the American culture and idealogy too. Like, I have to believe that Mark guy knew that he could pull that whole "they paint it, i sign it" thing off because he knew enough dumb, starstruck Americans would love to get the recognition of having worked for a 'great artist' or 'controversial' artist. when really, he's just messing with everybody and abusing our stupidity. i mean, if i did the actual painting, i'll be damned if somebody's gonna sign it, even if it was their idea. ideas aren't the esteemed intellectual property some people seem to think. what you create, that can be physically manifested, that's quite different. but ideas are just abstracts, and i think everything's already been thought of. we already know everything there is to know, it's just a process of unlocking bits and pieces in different ways at different times. a teacher of mine once told me that every melody up to 15 notes, for instance, has already been written. interesting stuff.

*shrug*

me'
04-29-2004, 07:36 PM
we already know everything there is to know,This is so untrue. There are countless disciplines, especially of physics and mathematics, which we're no way near toward understanding. Off the top of my head, quantum mechanics has hardly been touched compared to many other existing subjects. We know that the human brain uses electricty, we're beginning to assign parts of the brain to different tasks, but it's still far beyond our currently understanding. Call me an optimist (and an off topic optimist at that) but I do not believe we're anywhere near to knowing everything.
a teacher of mine once told me that every melody up to 15 notes, for instance, has already been written.Also untrue. There is an infinite quality about music -- you can keep shifting down the octaves and end up with a note potentially infinitely low or high. Therefore, there's an infinite number of melodies of 15 notes, so not all of them have been thought of.

Of course, that depends on your cultural definition of melody (whether it has to represent attractive music or not).

coder_seth
04-29-2004, 08:41 PM
haha.. you tried so hard to invalidate my OPINIONS, and yet you just reinforced them. for instance, you said:


This is so untrue. There are countless disciplines, especially of physics and mathematics, which we're no way near toward understanding.

Right. Emphasis on UNDERSTANDING. As in, we haven't unlocked it yet. Everything, even the most complex of theories or whatever, are based on the simplest of concepts that are within the grasp of everybody. I think maybe you misunderstood me, and I probably could have been clearer. It wouldn't be the first time. Obviously, I don't understand quantum physics as if I invented it. That's not what I meant by knowing everything.

And abotu the musical melodies thing, I guess I would assume that teacher meant relative to one octave. And perhaps he specified that at the time and I forgot.

At any rate, the simple point is that originality is overrated. People try too hard to be original rather than creative.

bradyj
04-29-2004, 08:53 PM
I think this is definately WAY off topic -- we should do any further discussion via PM if we want to continue. It's no longer insight and teaching, it's become opinated -- we should rant elsewhere, and not in this question.

coder_seth
04-29-2004, 08:56 PM
oh *yawn yawn* with your board-etiquette anal-retentiveness. the question is in TWO threads and has already been answered. we're now just discussing as human beings. nothing wrong with it at all. :D

Mhtml
04-29-2004, 10:05 PM
I think this is definately WAY off topic -- we should do any further discussion via PM if we want to continue. It's no longer insight and teaching, it's become opinated -- we should rant elsewhere, and not in this question.
Thanks Brady, saved me from having to post that :thumbsup: ..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum