473,671 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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


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.

Oct 22 '07 #1
9 3426
In article
<11************ **********@y27g 2000pre.googleg roups.com>,
Summercool <Su************ @gmail.comwrote :
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
Oct 22 '07 #2
On Oct 22, 3:56 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
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).


Oct 23 '07 #3
In article
<11************ **********@e9g2 000prf.googlegr oups.com>,
Summercool <Su************ @gmail.comwrote :
On Oct 22, 3:56 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
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
Oct 23 '07 #4
On Oct 22, 5:19 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
In article
<1193098168.791 439.119...@e9g2 000prf.googlegr oups.com>,

Summercool <Summercooln... @gmail.comwrote :
On Oct 22, 3:56 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
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.
Oct 23 '07 #5
In article
<11************ **********@z24g 2000prh.googleg roups.com>,
ke************* ********@gmail. com wrote:
On Oct 22, 5:19 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
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 <imgfor
each type. Thus

<img class="landscap e" 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
Oct 23 '07 #6
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
Oct 23 '07 #7
On Oct 22, 6:10 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
img {max-width: 100px;}

or

img {max-height: 100px;}
>
<img class="landscap e" 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.
Oct 23 '07 #8
In article
<11************ **********@z24g 2000prh.googleg roups.com>,
Summercool <Su************ @gmail.comwrote :
On Oct 22, 6:10 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
img {max-width: 100px;}

or

img {max-height: 100px;}

<img class="landscap e" 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
Oct 23 '07 #9
In article
<do************ *************** *******@news-vip.optusnet.co m.au>,
dorayme <do************ @optusnet.com.a uwrote:
You might go to the php.alt nesgroup
for help with this.
alt.php rather...

--
dorayme
Oct 23 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2597
by: Phil... | last post by:
how can i find the width and height of a jpeg file i am not interested in viewing the file i just want the height and width
14
21519
by: delerious | last post by:
I need to determine an element's width and height in pixels (not including padding, border, and margin) in Javascript. The element will not have width or height styles specified. In Mozilla, I know I can use document.defaultView.getComputedStyle() to do this. IE does not support document.defaultView.getComputedStyle(). It supports offsetWidth/offsetHeight, but those include the padding and border. IE also supports...
5
12301
by: homecurr | last post by:
I am writing a tool to generate html and have a problem with the <img> tag. The tool generates something like "<img src="...">". At the time the html is generated, the tool does not know the actual image size, but I do want to resize any image so that their width and height will both be smaller than 100. I also want to keep the iamge width/height ration so the image looks "normal". If I use <img src="..." width=100 height=100> the image...
15
1124
by: DM | last post by:
For <img> tags, are the width and height attributes necessary? Could they just be omitted? dm
2
1579
by: Jim Ciotuszynski | last post by:
Anybody know where I can find an example or documentation on how to get and possibly set the width/height of the active browser's window. Thank in advance, Jim Ciotuszynski
1
9225
by: Nathan Sokalski | last post by:
I am using the ImageUrl property of the Hyperlink control to create a graphical Hyperlink. However, I want to change the size of the image I am using, but the generated HTML places the width/height properties in the anchor tag rather than the image tag. Obviously I could write code to generate the anchor/image tags myself, but when a control as nice as the Hyperlink already exists I want to know if there is any kind of workaround that will...
3
7819
by: yxq | last post by:
Hello, I use the com component "shockwave flash object" to play flash file, but how to get the actual size (width*height) of flash file but no control size? thank you!
10
3282
by: News | last post by:
I am trying to be able to manipulate the width and height of an <img> but do not seem to be able. "Yes", I know the JavaScript will "not" manip anything, which is ok. I simply do not know how to capture the width or height. Once I can do that I can manipulate them. Here is the HTML for the <img> <div class="ImgMnp" id="myImg" onmouseover="imgSize('myImg','fpImg)"> <img src="images/FirePlace.jpg" width="480" height="640" id="fpImg" />
9
2149
by: Summercool | last post by:
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
1
2127
dmjpro
by: dmjpro | last post by:
var iFrame = document.createElement('IFRAME'); iFrame.name = 'frame'; iFrame.id = 'frame'; iFrame.addEventListener("load",function(){ var w = getDocWidth('frame'); var h = getDocHeight('frame'); alert(w+'\t'+h); iFrame.width = w + 'px'; iFrame.height = h + 'px'; },true);
0
8481
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.