Window size without javascript

H

Helpful person

I have created a link. This leads to a page that has only an image.
Is there a way I can set the window size to be equal to the image
without using javascript?

Thanks
 
H

Helpful person

I have created a link.  This leads to a page that has only an image.
Is there a way I can set the window size to be equal to the image
without using javascript?

Thanks

I forgot to mention that I know the size of the image, so the width
and height can be hard coded.
 
G

Gus Richter

Helpful said:
I forgot to mention that I know the size of the image, so the width
and height can be hard coded.


Instead of thinking to set the window size to the size of the image,
which I think is impossible for all conditions IMHO, try to set the
image to the window size.

<img src="image.png" style="width: 100%;">
 
H

Helpful person

Instead of thinking to set the window size to the size of the image,
which I think is impossible for all conditions IMHO, try to set the
image to the window size.

    <img src="image.png" style="width: 100%;">

Thanks, but some of my images are fairly small and would look very
poor for large window sizes.
 
A

Ari Heino

Helpful person kirjoitti seuraavasti:
Thanks, but some of my images are fairly small and would look very
poor for large window sizes.

You could then use <img src="image.png" style="max-width: 100%;">
although this doesn't work in older IEs at least.
 
R

Raymond Schmit

Thanks, but some of my images are fairly small and would look very
poor for large window sizes.

So you found the answer you where looking for .....
Don't try to impose the window size ... let the end-user do what he
want.
 
D

dorayme

Gus Richter said:
Instead of thinking to set the window size to the size of the image,
which I think is impossible for all conditions IMHO, try to set the
image to the window size.

<img src="image.png" style="width: 100%;">

The OP, on average, would be unlikely to be wanting the distortion that
comes with this. And besides, he would need to set height 100% to
satisfy his window size criterion. Though there are complications re
aspect ratio across browsers. In Opera, if you leave out height, it
supplies 100% mostly! At a crucial calculation point of window width it
decides not to supply the height - nor probably the width (as if some
penny drops for it and it realises it is being had and decides not to
mess about and so it then supplies the natural aspect ratio).

I came across an old picture that lent itself somewhat naturally to the
distortions of being stretched:

http://dorayme.890m.com/cacheTest/test1.html

Astute observers might be able to guess the natural aspect, and Upsdale
will, of course, be able to guess straight away the absolute natural
dimensions. I am wearing the helmet photographed. One day, btw, a few
years ago, this helmet decided to display all the things it had seen, it
was bored not being used, you see and made like an autonomous free to
air TV. It began to haunt me so I threw the damn thing out.
 
G

Gus Richter

dorayme said:
The OP, on average, would be unlikely to be wanting the distortion that
comes with this. And besides, he would need to set height 100% to
satisfy his window size criterion. Though there are complications re
aspect ratio across browsers. In Opera, if you leave out height, it
supplies 100% mostly! At a crucial calculation point of window width it
decides not to supply the height - nor probably the width (as if some
penny drops for it and it realises it is being had and decides not to
mess about and so it then supplies the natural aspect ratio).

I, myself would not consider the OP's route and requirements. I simply
made a suggestion based on the OP's requirements. If other criteria is
to be introduced into the mix, so be it; other mods required.

I'm not into photography, but have noted that some photographers go to
lengths to have distortions on purpose (aspect ratio adjustments?). That
being said, it all depends on the photo and inherent size used IMHO.
I've seen a post (which I copied and have saved somewhere) explaining a
way to provide width:100% and an aspect ratio of height/width=2/3 and if
of interest, would be willing to go look for it.
I came across an old picture that lent itself somewhat naturally to the
distortions of being stretched:

http://dorayme.890m.com/cacheTest/test1.html

Astute observers might be able to guess the natural aspect, and Upsdale
will, of course, be able to guess straight away the absolute natural
dimensions.

I'm not a photography buff (so my opinion on this may not matter), but
to me your photo looked ok here. Stretched out a bit, but could be on
purpose to get effect, dunno.

No need to guess. Looking at the image, it says that the inherent
dimensions are 564x752px.
I am wearing the helmet photographed. One day, btw, a few
years ago, this helmet decided to display all the things it had seen, it
was bored not being used, you see and made like an autonomous free to
air TV. It began to haunt me so I threw the damn thing out.

So I assume that you kept the bike. What make is it if I may ask?
 
G

Gus Richter

Helpful said:
Thanks, but some of my images are fairly small and would look very
poor for large window sizes.


I've re-read your requirement again and find that I've had another
senior moment and misunderstood, so here is to my new understanding:

When you open another window, the new window can only be resized with a
script, AFAIK.

I have my browser(s) set to open a new tab instead of a new window and I
don't know how, or if, that would affect a script. A javascript
newsgroup would be the proper venue.
 
H

Helpful person

Thanks, but some of my images are fairly small and would look very
poor for large window sizes.- Hide quoted text -

- Show quoted text -

Thanks for the answers. Looks like it can't be down with HTML / CSS
alone.
 
J

Jonathan N. Little

Helpful said:
I have created a link. This leads to a page that has only an image.
Is there a way I can set the window size to be equal to the image
without using javascript?

No.
 
D

dorayme

Gus Richter said:
I'm not into photography, but have noted that some photographers go to
lengths to have distortions on purpose (aspect ratio adjustments?). That
being said, it all depends on the photo and inherent size used IMHO.
I've seen a post (which I copied and have saved somewhere) explaining a
way to provide width:100% and an aspect ratio of height/width=2/3 and if
of interest, would be willing to go look for it.

Unless I (a leading martian photographer) wanted to do some sort of HTML
art - photography peculiar to the webpage - I prepare photos to the size
I want beforehand. At least in respect to aspect ratio. How one works on
an individual photograph beforehand is a different matter and a big one
too.

There is the *natural aspect* that is preserved no matter how you crop a
pic. Cropping a pic that is 16" x 20" to 10" x 10" (to show just the
head of someone, say) does not change the "natural aspect" of the
details. In other words, there is no distortion. And this natural aspect
is constant under projection, the variable being only distance from neg
to paper or in the case of a webpage, the size of the browser window
(the width/height ratio of the file image being able to be preserved in
some if not all browsers).

Photographers very rarely change the natural aspect of their pictures.
Now and then I have corrected some converging lines by angling the paper
or the lens but this is rare.

I'm not a photography buff (so my opinion on this may not matter), but
to me your photo looked ok here. Stretched out a bit, but could be on
purpose to get effect, dunno.

No need to guess. Looking at the image, it says that the inherent
dimensions are 564x752px.


So I assume that you kept the bike. What make is it if I may ask?

No, that particular bike, a Triumph Trophy, was stolen on a trip to
Melbourne. When a partner and I came back to it in a street one evening,
all that was there was a broken link from the chain! The scene of a
bloke and his wife with helmets in hand (we still had the helmets)
hitching back to Sydney must have looked a bit peculiar to others. I
know I felt silly and furious at the same time.
 
G

Gus Richter

dorayme said:
Photographers very rarely change the natural aspect of their pictures.
Now and then I have corrected some converging lines by angling the paper
or the lens but this is rare.

I was thinking along the lines of using a "fisheye lens" for the effect.
No, that particular bike, a Triumph Trophy, was stolen on a trip ....

Sounds like you had more than one. Takes me back to my younger days. I
had only one for a few years, a BSA 650cc Golden Flash. Friends rode BSA
Rocket, Triumphs, Nortons. Some of my wilder years.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,797
Messages
2,569,647
Members
45,374
Latest member
VernitaBer

Latest Threads

Top