Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   How to resize <IMG> width absolute and height relative ? (http://www.velocityreviews.com/forums/t157908-how-to-resize-img-width-absolute-and-height-relative.html)

Wladimir Borsov 05-03-2004 12:11 PM

How to resize <IMG> width absolute and height relative ?
 
As well known for <IMG ...> tags in web pages a width and a height attribute can be
applied. What I want to do now is to fix the width for ALL the images on my web page
to exactly lets say 70 pixel regardless how big the originals are.

The height should be adjusted proportional so that the resulting thumbnail is not distorted.
But as far as I know there is no such attribute like

<IMG SRC=...... WIDTH=70 HEIGHT="Adjust proportional to Width"> ....

How can I solve this problem ?

As a second best solution I could accept if I could write percentage values:


<IMG SRC=..... WIDTH=50% HEIGHT=50%>

but this doesn't work too.

Wladimir


nice.guy.nige 05-03-2004 02:52 PM

Re: How to resize <IMG> width absolute and height relative ?
 
[re-posted to alt.html, as the original went elsewhere for some odd reason!]

While the city slept, Wladimir Borsov <wladimirb@gmx.net> feverishly typed:

> As well known for <IMG ...> tags in web pages a width and a height
> attribute can be applied. What I want to do now is to fix the width
> for ALL the images on my web page
> to exactly lets say 70 pixel regardless how big the originals are.
>
> The height should be adjusted proportional so that the resulting
> thumbnail is not distorted. But as far as I know there is no such
> attribute like
>
> <IMG SRC=...... WIDTH=70 HEIGHT="Adjust proportional to Width"> ....
>
> How can I solve this problem ?
>
> As a second best solution I could accept if I could write percentage
> values:
>
>
> <IMG SRC=..... WIDTH=50% HEIGHT=50%>
>
> but this doesn't work too.
>
> Wladimir


--
Nigel Moss.

Email address is not valid. nigel@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
In the land of the blind, the one-eyed man is very, very busy!



nice.guy.nige 05-03-2004 06:22 PM

Re: How to resize <IMG> width absolute and height relative ?
 
[I think I should just go and get some sleep, really!]

While the city slept, nice.guy.nige <nigel_moss@deadspam.com> feverishly
typed:

> [re-posted to alt.html, as the original went elsewhere for some odd
> reason!]
>
> While the city slept, Wladimir Borsov <wladimirb@gmx.net> feverishly
> typed:
>
>> As well known for <IMG ...> tags in web pages a width and a height
>> attribute can be applied. What I want to do now is to fix the width
>> for ALL the images on my web page
>> to exactly lets say 70 pixel regardless how big the originals are.
>>
>> The height should be adjusted proportional so that the resulting
>> thumbnail is not distorted. But as far as I know there is no such
>> attribute like
>>
>> <IMG SRC=...... WIDTH=70 HEIGHT="Adjust proportional to Width"> ....
>>
>> How can I solve this problem ?
>>
>> As a second best solution I could accept if I could write percentage
>> values:
>>
>>
>> <IMG SRC=..... WIDTH=50% HEIGHT=50%>
>>
>> but this doesn't work too.
>>


You can use a server-side solution, such as PHP to do the maths. Off the top
of my head, if you know the original image width and heght (if not, no
problems as you can get them using PHP) something like the following should
work;

<? php

$desiredwidth = 70;
$originalwidth = 100; // replace originalwidth and originalheight with
whatever the image dimensions are...
$originalheight = 200; // ... or find a better way of getting them!

$ratio = $originalwidth / $desiredwidth;
$desiredheight = $originalheight / $ratio;

print("<img src=\"whatever.jpg\" width=\"$desiredwidth\"
height=\"$desiredheight\" alt=\"whatever\">\n");
>


I haven't thoroughly checked this, so the maths may be wrong! But it still
shows a way to do it.

Remember, though, that if an original image is smaller than 70 pixels wide,
then this may result in distortion of the image as it will be stretched.
Remember also that this is a bad way to make thumbnails of large images, as
the full size image file still has to be loaded, regardless of how small you
are making it appear on the screen.

Hope that helps,
Nige

--
Nigel Moss.

Email address is not valid. nigel@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
In the land of the blind, the one-eyed man is very, very busy!



Mitja 05-03-2004 08:51 PM

Re: How to resize <IMG> width absolute and height relative ?
 
Wladimir Borsov <wladimirb@gmx.net>
(news:c75ct8$iqe$06$1@news.t-online.com) wrote:
> As well known for <IMG ...> tags in web pages a width and a height
> attribute can be applied. What I want to do now is to fix the width
> for ALL the images on my web page
> to exactly lets say 70 pixel regardless how big the originals are.
>
> The height should be adjusted proportional so that the resulting
> thumbnail is not distorted. But as far as I know there is no such
> attribute like
>
> <IMG SRC=...... WIDTH=70 HEIGHT="Adjust proportional to Width"> ....
>
> How can I solve this problem ?


<img width="70" SRC="..."> :)

> As a second best solution I could accept if I could write percentage
> values:
>
>
> <IMG SRC=..... WIDTH=50% HEIGHT=50%>
>
> but this doesn't work too.
>
> Wladimir




Mark Parnell 05-03-2004 10:57 PM

Re: How to resize <IMG> width absolute and height relative ?
 
On Mon, 3 May 2004 15:52:15 +0100, "nice.guy.nige"
<nigel_moss@deadspam.com> declared in alt.html:

> [re-posted to alt.html, as the original went elsewhere for some odd reason!]


Because the OP set followups to ciwah.

--
Mark Parnell
http://www.clarkecomputers.com.au

MarkSatterfield 01-26-2008 02:58 PM

Just enter the width. The height is auto adjusting.

Example... <img width=165 alt="Mark Satterfield" src="ht...

See this in action at http://satterfield.890m.com.

Mark
http://www.marksatterfield.com

MarkSatterfield 03-02-2008 04:37 AM

Added CSS Image resizing with floats to http://www.marksatterfield.com

--Mark Satterfield

http://www.marksatterfield.com
http://mark.a.satterfield.googlepages.com
http://satterfield.890m.com

eswar 04-20-2012 08:44 AM

please tell " how to attach the image in small size at html coding program"


All times are GMT. The time now is 06:25 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57