473,738 Members | 10,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restricting inline image size

Hello,

I have an HTML question that I'm not sure can be solved. I want to
restrict the maximum size of an inline image.

For example, I can force the image to be 200x200 if I do this:
<img src=blah.gif width=200 height=200>

But, that messes up the aspect ratio, and could size the image larger than
it's original size.

What I want is a way to size an image such that it's aspect ratio is
preserved and the image is less than the given size (let's say 200x200 for
now).

I've tried placing the image in a table cell, and setting the table cell
size to 200x200, but that doesn't work as the image displays in full size
(stretching the table cell beyond that I specified)

Yes, I know I can do this by manually resizing the image, or fetching the
dimensions of the image and calculating a size myself. But, I am
specifically looking for a way to do it with an inlime image without
fetching it first.

Thanks

-----------------------------------------------------------
Posted using QuadSucker/News, http://www.quadsucker.com
... the ultimate tool for newsgroup downloading!

-----------------------------------------------------------
Jul 24 '05 #1
4 16664
no*****@no-spam.com wrote:
Yes, I know I can do this by manually resizing the image, or fetching the
dimensions of the image and calculating a size myself. But, I am
specifically looking for a way to do it with an inlime image without
fetching it first.


Sounds like you are doing inappropriate things with that image, explain
the context.

--
Spartanicus
Jul 24 '05 #2
In message <11************ *@news.supernew s.com>, no*****@no-spam.com
writes
Hello,

I have an HTML question that I'm not sure can be solved. I want to
restrict the maximum size of an inline image.

For example, I can force the image to be 200x200 if I do this:
<img src=blah.gif width=200 height=200>

But, that messes up the aspect ratio, and could size the image larger than
it's original size.

What I want is a way to size an image such that it's aspect ratio is
preserved and the image is less than the given size (let's say 200x200 for
now).

I've tried placing the image in a table cell, and setting the table cell
size to 200x200, but that doesn't work as the image displays in full size
(stretching the table cell beyond that I specified)

Yes, I know I can do this by manually resizing the image, or fetching the
dimensions of the image and calculating a size myself. But, I am
specifically looking for a way to do it with an inlime image without
fetching it first.

Thanks

-----------------------------------------------------------
Posted using QuadSucker/News, http://www.quadsucker.com
... the ultimate tool for newsgroup downloading!

-----------------------------------------------------------


(a) Place the image in a containing DIV which you set to the appropriate
width (say 200px).

(b) Then set the <img> size as: width="100%'

That will cause the browser to resize the image and display it as 200px
wide.

Depending on what you are trying to do, resizing the image in an image
editor beforehand is usually the best approach.

What are you trying to do?

regards.
--
Jake

Jul 24 '05 #3
"" wrote in comp.infosystem s.www.authoring.html:
What I want is a way to size an image such that it's aspect ratio is
preserved and the image is less than the given size (let's say 200x200 for
now).


Then you want an image processor, such as the free Irfanview (if
you're on Windows, which I imagine you are):
http://www.irfanview.com/

Do not, repeat not, resize images in HTML. First, mst browsers do a
poorer job than most image processors. Second, it's pretty silly to
download a big image and then display it as a small image.

--

Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
Jul 24 '05 #4
Hamster_Huey
3 New Member
In message <114j5m4ennivd6 4@news.supernew s.com>, no-spam@no-spam.com
writes[color=blue]
>Hello,
>
>I have an HTML question that I'm not sure can be solved. I want to
>restrict the maximum size of an inline image.
>
>For example, I can force the image to be 200x200 if I do this:
><img src=blah.gif width=200 height=200>
>
>But, that messes up the aspect ratio, and could size the image larger than
>it's original size.
>
>What I want is a way to size an image such that it's aspect ratio is
>preserved and the image is less than the given size (let's say 200x200 for
>now).
>
>I've tried placing the image in a table cell, and setting the table cell
>size to 200x200, but that doesn't work as the image displays in full size
>(stretching the table cell beyond that I specified)
>
>Yes, I know I can do this by manually resizing the image, or fetching the
>dimensions of the image and calculating a size myself. But, I am
>specifically looking for a way to do it with an inlime image without
>fetching it first.
>
>Thanks
>
>-----------------------------------------------------------[color=green]
>> Posted using QuadSucker/News, http://www.quadsucker.com
>> ... the ultimate tool for newsgroup downloading![/color]
>-----------------------------------------------------------[/color]

(a) Place the image in a containing DIV which you set to the appropriate
width (say 200px).

(b) Then set the <img> size as: width="100%'

That will cause the browser to resize the image and display it as 200px
wide.

Depending on what you are trying to do, resizing the image in an image
editor beforehand is usually the best approach.

What are you trying to do?

regards.
--
Jake
I've got the exact same problem, and i've seen that solution in practice, however i cant seem to work it to solve my problem. Specifically, im not sure how to change the width attribute properly. I've got a simple page with a 1 row table with 3 columns on it.

First column = image
Second column = text
Third column = blank space

I want the first and last columns to be equal size and smaller than the middle column of text. How do i adjust the width of the cell containing the image then to make this work? Do the widths of all the columns have to add up to anything??

Thanks in advance for any help,
Sev
Aug 23 '05 #5

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

Similar topics

38
5083
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find out what i'm doing wrong, and so far it seems i'm doing it the right way. Here's my code...any suggestions would be appreciated. <script language="javascript"> <!-- window.open("256fx/index.htm", "", "height=400, width=600"); //-->
4
16213
by: Kenny | last post by:
I have been trying to write a script that will increase the size of and image when you mouse over it, and decrease it to original size, when you mouse out. After a couple of attempts, this is what I've come up with. In this example, there are 5 images (0 thru 4) all with a height of 80px. When you mouse over an image, it changes the growingImage variable equal to the number of the image you mouse over, when you mouse out, it sets it to 5,...
7
4474
by: Haines Brown | last post by:
I'm in the practice of specifying img width and height in my style definitions, although I usually use the actual size of the image. I'm reworking the style and it would be convenient to leave image size unspecified unless I need to change its dispayed size. What, if any, are the reasons why an image size should be specified in a stylesheet if it will be displayed in its actual size? -- Haines Brown
7
5090
by: Leszek | last post by:
Hello, I need to set dynamically height and width attributes of an image control on a WebForm. I know how to read the whole image from the hard-drive and use its height and width properties. I guess it is not efficient as the whole image needs to be read. I need to retrieve only two parameters: height and width. Is it possible to read only the size of image from the hard-drive?
11
2024
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the the image but in design time mode all variables concerning Server or Context ar not set ! ...so I can't use MapPath function to obtain the physical parth of the picture ... So my second question is how to retrieve the physical root path of the...
0
990
by: Bill Rowell | last post by:
ASP .NET has a built in limit of the request size (which is configurable) of 4MB. So, if a user were to upload a file that exceeded this, an exception is thrown and a not so informative page is displayed due to the error code being set to 400 (the page cannot be displayed page). I found an article that had this snippet of code that you can add to global.asax.vb that you could "hopefully" redirect the user to a more friendly looking...
9
1500
by: klausklausenator | last post by:
Hi all, I have a php-generated webpage with images. My problem is: the Internet Explorer cannot calculate the correct image size. Because of this the images are not cached. So everytime a user clicks on some link all the images gets retransfered and the page loads very slow. You can check it if you right-click on an image and select properties. Is there a possibility to send the image and its actual size-information to the browser?
7
8199
by: finecur | last post by:
I have a <img scr="mypic.jpg"in my html. I would like to display the image by width=200 if the image width is larger than 200. I also would like to display the image by its real width if the image width is smaller than 200. How can I do it? Thanks, qq
2
2141
pradeepjain
by: pradeepjain | last post by:
hii guys, I am storing a image in a database in form of blob and now i want to send that image as a inline image in a mail ..how to do it.. this is the code ..plzz help <?php mysql_connect("localhost","root","12345"); mysql_select_db("pyz"); $str_sql="select * from xyz where id= '".$_GET."'";; $Colloquiums1 = array();
0
8788
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,...
1
9263
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
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
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
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.