HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Image resize question, please help
Post new topic   Reply to topic    HTML Help Forum -> General HTML
View previous topic :: View next topic  
Author Message
dmomm



Joined: 22 Sep 2009
Posts: 1

PostPosted: Tue Sep 22, 2009 7:09 am     Image resize question, please help Reply with quote

My first website, okay? Please be kind. (-:

How do you tell the image to be smaller in html? I don't want to go back to Photoshop to resize it. Is that even possible?

Here's my code so far:

<p align="center">
<img src="web hdr.jpg" alt="Lakeview UCC Church"

width="1000" height="157">
</p>
sticks464



Joined: 31 Dec 2006
Posts: 2625

PostPosted: Tue Sep 22, 2009 9:38 am     Reply with quote

You can change these numbers to any size you want.
width="1000" height="157"
Reducing it with the browser will not keep it in proportion like photoshop will. It takes less that a minute to resize in photoshop and is the best way.
PayneLess Designs



Joined: 28 Feb 2007
Posts: 4268
Location: MS

PostPosted: Tue Sep 22, 2009 9:40 am     Reply with quote

This is a proper image tag:
Code:
<img style="width: XXpx; height: YYpx; border: 0;" src="Path to image" alt="Text Description">


DO NOT USE COMPOUND folder and file names: "web hdr.jpg"

Change to one of these:

web_hdr.jpg
web-hdr.jpg
webhdr.jpg

Some browsers will not accept white space in a file name and will not be able to load the file.

In your case, just reduce the width/height of those attributes, but do it so it maintains the same aspect ratio: w:h

1000:157 is an aspect ratio of 6.3694267:1

If you reduce the width by 1/2 to 500 (px), then the height will be 500 / aspect ratio or 500 / 6.3694267 = 78.5 (px). Can't have half a pixel so round up/down. Using conventional math rounding techniques, 78.5 will be just 78. Then:
Code:
<img style="width: 500px; height: 78px; border: 0;" src="web_hdr.jpg" alt="Web Header">
[/code]
cfaj



Joined: 13 Apr 2009
Posts: 4

PostPosted: Sun Sep 27, 2009 5:14 pm     Reply with quote

sticks464 wrote:
You can change these numbers to any size you want.
width="1000" height="157"
Reducing it with the browser will not keep it in proportion like photoshop will. It takes less that a minute to resize in photoshop and is the best way.


Reducing it in the browser will keep the same proportions if you only specify one dimension.

If you want to specify both, make sure you use the correct proportions. I use this script (called prop) to get the final dimension:

Code:

awk  "BEGIN { print ($2 * $3) / $1; exit }"


I call it with, for example:

Code:

prop width height newwidth


Or:

Code:

prop height width newheight
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> General HTML All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial