Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > want max width and max height as long as not exceed 100px

Reply
Thread Tools

want max width and max height as long as not exceed 100px

 
 
Summercool
Guest
Posts: n/a
 
      10-22-2007

I wonder to show the images in a table format... and to set a box of
width 100px and height 100px, is there a way?

Right now, if I set width to 100px, then height can be 180px...

If I set height to 100px, then width can be 260px...

What I really want is, to have the greatest width and greatest height
so long as none of them exceed 100px, and maintaining the aspect
ratio. (I don't want to set both width and height to 100px for the
aspect ratio will be weird...)

so powerful as HTML and CSS is, is the above possible?

So it might be possible to use Javascript... but what about for users
who have javascript turned off? and because I am loading the jpg
files in one .php, and posting to another .php file and setting the
HTML in the second file... so getting the width and height info in the
first page and passing it to the second .php can be kind of messy.

 
Reply With Quote
 
 
 
 
dorayme
Guest
Posts: n/a
 
      10-22-2007
In article
<(E-Mail Removed) .com>,
Summercool <(E-Mail Removed)> wrote:

> I wonder to show the images in a table format... and to set a box of
> width 100px and height 100px, is there a way?
>
> Right now, if I set width to 100px, then height can be 180px...
>
> If I set height to 100px, then width can be 260px...
>
> What I really want is, to have the greatest width and greatest height
> so long as none of them exceed 100px, and maintaining the aspect
> ratio. (I don't want to set both width and height to 100px for the
> aspect ratio will be weird...)
>
> so powerful as HTML and CSS is, is the above possible?


You cannot dictate to table cells their sizes and expect
consistent results regardless of the size of the content across
browsers.

What is the closest webpage you have seen on the internet that
satisfies you. And what further things would you like. In other
words, a url of some sort might help.

--
dorayme
 
Reply With Quote
 
 
 
 
Summercool
Guest
Posts: n/a
 
      10-23-2007
On Oct 22, 3:56 pm, dorayme <(E-Mail Removed)> wrote:
> You cannot dictate to table cells their sizes and expect
> consistent results regardless of the size of the content across
> browsers.
>
> What is the closest webpage you have seen on the internet that
> satisfies you. And what further things would you like. In other
> words, a url of some sort might help.


it is just like a website showing thumbnails... in a 5 x 3 tables

and the thumbnails are showing as 100 x 80, or 75 x 100.... that is,
either width or height as a max of 100px...

except i don't know the image sizes in advance. (they are from a
database or URLs from a database).




 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      10-23-2007
In article
<(E-Mail Removed). com>,
Summercool <(E-Mail Removed)> wrote:

> On Oct 22, 3:56 pm, dorayme <(E-Mail Removed)> wrote:
> > You cannot dictate to table cells their sizes and expect
> > consistent results regardless of the size of the content across
> > browsers.
> >
> > What is the closest webpage you have seen on the internet that
> > satisfies you. And what further things would you like. In other
> > words, a url of some sort might help.

>
> it is just like a website showing thumbnails... in a 5 x 3 tables
>
> and the thumbnails are showing as 100 x 80, or 75 x 100.... that is,
> either width or height as a max of 100px...
>
> except i don't know the image sizes in advance. (they are from a
> database or URLs from a database).


Your "the thumbnails are showing as 100 x 80, or 75 x 100....
that is, either width or height as a max of 100px..." just goes
into my brain and simply does not register a plain coherent
thought. Perhaps someone else will see what you want?

In plainer terms what do you want? Perhaps you can speak in quite
different terms? Do you want all the cells to be exactly the same
dimension in spite of the pics inside the cells being all a bit
different? I can think of solutions for this but I don't want to
go off on a wild goose chase.

Why not post some examples (urls please) of what you are trying
and then explain what it is in reference to these specific urls
what it is you do not like about them?

--
dorayme
 
Reply With Quote
 
kenneth.kin.lum.at.work@gmail.com
Guest
Posts: n/a
 
      10-23-2007
On Oct 22, 5:19 pm, dorayme <(E-Mail Removed)> wrote:
> In article
> <(E-Mail Removed). com>,
>
>
>
> Summercool <(E-Mail Removed)> wrote:
> > On Oct 22, 3:56 pm, dorayme <(E-Mail Removed)> wrote:
> > > You cannot dictate to table cells their sizes and expect
> > > consistent results regardless of the size of the content across
> > > browsers.

>
> > > What is the closest webpage you have seen on the internet that
> > > satisfies you. And what further things would you like. In other
> > > words, a url of some sort might help.

>
> > it is just like a website showing thumbnails... in a 5 x 3 tables

>
> > and the thumbnails are showing as 100 x 80, or 75 x 100.... that is,
> > either width or height as a max of 100px...

>
> > except i don't know the image sizes in advance. (they are from a
> > database or URLs from a database).

>
> Your "the thumbnails are showing as 100 x 80, or 75 x 100....
> that is, either width or height as a max of 100px..." just goes
> into my brain and simply does not register a plain coherent
> thought. Perhaps someone else will see what you want?
>
> In plainer terms what do you want? Perhaps you can speak in quite
> different terms? Do you want all the cells to be exactly the same
> dimension in spite of the pics inside the cells being all a bit
> different? I can think of solutions for this but I don't want to
> go off on a wild goose chase.
>
> Why not post some examples (urls please) of what you are trying
> and then explain what it is in reference to these specific urls
> what it is you do not like about them?



it is like

http://images.google.com/images?q=dolphin

see, each image is displayed as a small size thumbnail.

the width AND height BOTH not exceed 100px, for example.

aspect ratio kept the same.


 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      10-23-2007
In article
<(E-Mail Removed) .com>,
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> On Oct 22, 5:19 pm, dorayme <(E-Mail Removed)> wrote:


> > Why not post some examples (urls please) of what you are trying
> > and then explain what it is in reference to these specific urls
> > what it is you do not like about them?

>
>
> it is like
>
> http://images.google.com/images?q=dolphin
>
> see, each image is displayed as a small size thumbnail.
>
> the width AND height BOTH not exceed 100px, for example.
>
> aspect ratio kept the same.


The aspects of the pictures are all different here. The lines are
not like in tables at all; even the bottom of the captions are
not lined up in the rows. In my browsers at least. I am not
criticising the layout here. The pics plus the captions very much
exceed 100px in one or both directions (alter the font view
setting in your browser - try Firefox - to see). so I still
don't know what you want.

Are you referring just to the size of the thumbnails themselves?
if they do not exceed 100px that is usually because they are made
that way. if they are not made that way, and you want them to be
sized for the page specially, then you can do this by giving the
css instruction:

img {max-width: 100px;}

or

img {max-height: 100px;}

or both.

You need to see if this works across browsers. It is sure not to
in Internet Explorer 6.

If you get the widths and heights of the pics via server side
programming like php, you can then specify an actual width (say
100px) for the landscaped ones (they then will all be exactly the
same width and never higher than wide) and similarly with the
portrait ones (say 100px high) and never wider than high.

Failing that, you might sort the pictures somehow into two lots.
The portrait ones and the landscape ones and class the <img> for
each type. Thus

<img class="landscape" src="pic.jpg" ...> and in your css, put
only a width, say 100px. It will find its natural height.

<img class="portrait" src="pic.jpg" ...> and in your css, put
only a height, say 100px. It will find its natural width.

I can feel myself chasing gooses <g>

--
dorayme
 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      10-23-2007
Well bust mah britches and call me cheeky, on Tue, 23 Oct 2007 01:10:48 GMT
dorayme scribed:

> I can feel myself chasing gooses <g>


Well, if you actually get a goose, Travis will probably want to hear about
it.

--
Neredbojias
 
Reply With Quote
 
Summercool
Guest
Posts: n/a
 
      10-23-2007
On Oct 22, 6:10 pm, dorayme <(E-Mail Removed)> wrote:

> img {max-width: 100px;}
>
> or
>
> img {max-height: 100px;}


>
> <img class="landscape" src="pic.jpg" ...> and in your css, put
> only a width, say 100px. It will find its natural height.
>
> <img class="portrait" src="pic.jpg" ...> and in your css, put
> only a height, say 100px. It will find its natural width.


I think max-width and max-height both work in Firefox and Safari (the
latest), but not on IE 7.0....

that's a great solution, landscape and portrait....
is it true you still have to use javascript to tell whether it is
landscape or portrait if the picture is unknown beforehand from the
database?

at least I can pass a parameter to the next .php file saying whether
it is landscape or portrait and that can be cleaner than passing the
width x height.


 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      10-23-2007
In article
<(E-Mail Removed) .com>,
Summercool <(E-Mail Removed)> wrote:

> On Oct 22, 6:10 pm, dorayme <(E-Mail Removed)> wrote:
>
> > img {max-width: 100px;}
> >
> > or
> >
> > img {max-height: 100px;}

>
> >
> > <img class="landscape" src="pic.jpg" ...> and in your css, put
> > only a width, say 100px. It will find its natural height.
> >
> > <img class="portrait" src="pic.jpg" ...> and in your css, put
> > only a height, say 100px. It will find its natural width.

>
> I think max-width and max-height both work in Firefox and Safari (the
> latest), but not on IE 7.0....
>


max-width works with IE7 in general. I cannot vouch for it
working with images. It was with IE6 and less that max-width was
not supported.


> that's a great solution, landscape and portrait....
> is it true you still have to use javascript to tell whether it is
> landscape or portrait if the picture is unknown beforehand from the
> database?
>


No, you can do it with PHP. You might go to the php.alt nesgroup
for help with this.


> at least I can pass a parameter to the next .php file saying whether
> it is landscape or portrait and that can be cleaner than passing the
> width x height.


Sure. I am a bit of a fan of sorting these profiles into two and
organising thumbnails in two blocks without mixing them. I know,
it is more of a bore and involves actual work! <g>

I recommend not to use tables at all for where there are a lot of
thumbnails. You may care to look at a template like:

http://members.optushome.com.au/droo...thumbLandscape
Gallery7.html

(the js is an enhancement to centre the whole show, so don't be
distracted by it; without it, the pages work essentially the same)

Here is a similar (but slightly different implementation without
tables):

http://tvrs.org.au/gallery/gallery.html

The thing about floating or inline images is the way it very
usefully uses the space, automatically wrapping. It is done a lot
on the modern web and you simply cannot get this sort of
flexibility with tables.

--
dorayme
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      10-23-2007
In article
<(E-Mail Removed)>,
dorayme <(E-Mail Removed)> wrote:

> You might go to the php.alt nesgroup
> for help with this.


alt.php rather...

--
dorayme
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
Emulate max-width in MSIE/PC width: 36em; max-weidth: 97%; (Solutions a la Sven Tofte don't do it.) kriton Javascript 0 04-22-2005 10:14 PM
CSS min-width, max-width, and min-height with display:inline Lois HTML 1 12-27-2004 03:03 AM
LDAP Connection pooling exceed expected max number of sockets Colin Ryan Java 0 09-10-2004 09:09 AM
<TR style="height:100px"/> ... IE bug? John MacIntyre Javascript 4 07-19-2003 01:44 AM



Advertisments