Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - Sizing Images

 
Thread Tools Search this Thread
Old 01-07-2004, 10:20 PM   #1
Default Sizing Images


Now I know the following works just fine .....

<img src="some path to the image" width="200" height="150">

and creates an enlargement, or shrunken, image 200 pixels wide and
150 pixels tall.

But I'd like to do this dynamically. I.E. have a list of images of maybe
varying sizes. I want to access that list probably in some loop construct
and dynamically size each to the size I want.

What I don't want is to do what I'm in the middle of now of manually
copying each selected image then resizing each to what I need for the
web site application.

Thanks for all help .............. ALF




Allen Flick
  Reply With Quote
Old 01-07-2004, 10:35 PM   #2
Leif K-Brooks
 
Posts: n/a
Default Re: Sizing Images

Allen Flick wrote:
> Now I know the following works just fine .....
>
> <img src="some path to the image" width="200" height="150">
>
> and creates an enlargement, or shrunken, image 200 pixels wide and
> 150 pixels tall.


The width and height attributes are meant for saying what the size of
your image is, not what size you want it to be. Also, you're missing the
alt attribute.

> But I'd like to do this dynamically. I.E. have a list of images of maybe
> varying sizes. I want to access that list probably in some loop construct
> and dynamically size each to the size I want.


Use PHP and GD.

  Reply With Quote
Old 01-12-2004, 12:59 AM   #3
Allen Flick
 
Posts: n/a
Default Re: Sizing Images

Leif K-Brooks wrote:

> Allen Flick wrote:
> > Now I know the following works just fine .....
> >
> > <img src="some path to the image" width="200" height="150">
> >
> > and creates an enlargement, or shrunken, image 200 pixels wide and
> > 150 pixels tall.

>
> The width and height attributes are meant for saying what the size of
> your image is, not what size you want it to be. Also, you're missing the
> alt attribute.
>
> > But I'd like to do this dynamically. I.E. have a list of images of maybe
> > varying sizes. I want to access that list probably in some loop construct
> > and dynamically size each to the size I want.

>
> Use PHP and GD.


Well, with some playing around I can have smaller images just by giving
the above command smaller numbers. Of course, if I don't use the same
aspect ratio then the image is distorted, but if the aspect ratio is the same
it'll just be a smaller/larger image.

The ALT attribute is not necessary, so in just putting something in this
message I left it out for simplicity sake.

Then there's the <var> ....... </var> directive pair that supposedly
surround the name of a variable. I just thought there may be something
herein that would allow actual variable use.


  Reply With Quote
Old 01-12-2004, 03:46 AM   #4
Joel Shepherd
 
Posts: n/a
Default Re: Sizing Images

Allen Flick wrote:
> Leif K-Brooks wrote:
>> Allen Flick wrote:
>>
>>> Now I know the following works just fine .....
>>>
>>> <img src="some path to the image" width="200" height="150">
>>>
>>> and creates an enlargement, or shrunken, image 200 pixels wide
>>> and 150 pixels tall.

>>
>> The width and height attributes are meant for saying what the
>> size of your image is, not what size you want it to be.

>
> Well, with some playing around I can have smaller images just by
> giving the above command smaller numbers.


It's not a command.

And the effect is images that *appear* smaller, which is not the same
as smaller images.

The fact is, whatever size the original image is, the entire image
will be downloaded. A great way to annoy folks is to make them wait
for a large image to be downloaded, only to reduce its display size to
a thumbnail. A much more effective approach is to make a copy of the
original image, reduce the copy to thumbnail size (a size which
matches the attributes in your img tag), and let your visitors
download that instead.

> The ALT attribute is not necessary, so in just putting something in
> this message I left it out for simplicity sake.


Really? According to what standard?

> Then there's the <var> ....... </var> directive pair that
> supposedly surround the name of a variable. I just thought there
> may be something herein that would allow actual variable use.


No, it's to say, "the content of this element is the name of a
variable", which is pretty much all that HTML elements do. If you want
to write software, you need a programming language. JavaScript seems
to be popular for those who want to embed software in web pages.

--
Joel.

  Reply With Quote
Old 01-14-2004, 10:28 PM   #5
Allen Flick
 
Posts: n/a
Default Re: Sizing Images

Joel Shepherd wrote:

> Allen Flick wrote:
> > Leif K-Brooks wrote:
> >> Allen Flick wrote:
> >>
> >>> Now I know the following works just fine .....
> >>>
> >>> <img src="some path to the image" width="200" height="150">
> >>>
> >>> and creates an enlargement, or shrunken, image 200 pixels wide
> >>> and 150 pixels tall.
> >>
> >> The width and height attributes are meant for saying what the
> >> size of your image is, not what size you want it to be.

> >
> > Well, with some playing around I can have smaller images just by
> > giving the above command smaller numbers.

>
> It's not a command.


Semantics.


> And the effect is images that *appear* smaller, which is not the same
> as smaller images.
>
> The fact is, whatever size the original image is, the entire image
> will be downloaded. A great way to annoy folks is to make them wait
> for a large image to be downloaded, only to reduce its display size to
> a thumbnail. A much more effective approach is to make a copy of the
> original image, reduce the copy to thumbnail size (a size which
> matches the attributes in your img tag), and let your visitors
> download that instead.
>
> > The ALT attribute is not necessary, so in just putting something in
> > this message I left it out for simplicity sake.

>
> Really? According to what standard?


"not necessary" = the markup language does *not* require it

Worked several companies in my career and each had it's own
"standard" for document and software content. So, we know
that the great thing about standards is that there so many of
them to choose from.


> > Then there's the <var> ....... </var> directive pair that
> > supposedly surround the name of a variable. I just thought there
> > may be something herein that would allow actual variable use.

>
> No, it's to say, "the content of this element is the name of a
> variable", which is pretty much all that HTML elements do. If you want
> to write software, you need a programming language. JavaScript seems
> to be popular for those who want to embed software in web pages.


So what would using <var> ....... </var> benefit the user?

  Reply With Quote
Old 01-15-2004, 09:15 AM   #6
Steve Pugh
 
Posts: n/a
Default Re: Sizing Images

Allen Flick <> wrote:
>Joel Shepherd wrote:
>> Allen Flick wrote:
>> > Leif K-Brooks wrote:
>> >> Allen Flick wrote:
>> >>
>> >>> Now I know the following works just fine .....
>> >>>
>> >>> <img src="some path to the image" width="200" height="150">
>> >>>
>> > The ALT attribute is not necessary, so in just putting something in
>> > this message I left it out for simplicity sake.

>>
>> Really? According to what standard?

>
>"not necessary" = the markup language does *not* require it


Which markup language would that be? All versions of HTML/XHTML
published since 1997 have required the alt attribute.

>Worked several companies in my career and each had it's own
>"standard" for document and software content. So, we know
>that the great thing about standards is that there so many of
>them to choose from.


Yes you can choose from HTML 4.0, HTML 4.01, ISO HTML, XHTML 1.0 or
XHTML 1.1. But they all require the alt attribute. Have you been
working for companies that choose to write HTML 3.2 or HTML 2.0?
Or working for companies that invent their own markup language?

If you're not actually using HTML/XHTML then perhaps this isn't the
right newsgroup to ask your question in?

>> > Then there's the <var> ....... </var> directive pair that
>> > supposedly surround the name of a variable. I just thought there
>> > may be something herein that would allow actual variable use.

>>
>> No, it's to say, "the content of this element is the name of a
>> variable", which is pretty much all that HTML elements do. If you want
>> to write software, you need a programming language. JavaScript seems
>> to be popular for those who want to embed software in web pages.

>
>So what would using <var> ....... </var> benefit the user?


It tells the user (via their browser) that the marked up text is a
variable. The fact that the commonest browsers don't really
communicate this fact very well (they use a visual styling that is
identical to the styling used for other elements) is a flaw in the
browsers. In theory a user agent could use the markup to create a much
richer experience. At the moment an author can apply styles to the var
element to make variables stand out from the rest of a program listing
(the whole of which would be marked up via the <code> element).

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <> <http://steve.pugh.net/>
  Reply With Quote
Old 01-15-2004, 11:27 AM   #7
Whitecrest
 
Posts: n/a
Default Re: Sizing Images

In article <>,
says...
> >"not necessary" = the markup language does *not* require it

> Which markup language would that be? All versions of HTML/XHTML
> published since 1997 have required the alt attribute.


I believe Required = "will not work without" it in this case.

--
Whitecrest Entertainment
www.whitecrestent.com
  Reply With Quote
Old 01-15-2004, 11:37 AM   #8
Steve Pugh
 
Posts: n/a
Default Re: Sizing Images

Whitecrest <> wrote:

>In article <>,
>says...
>> >"not necessary" = the markup language does *not* require it

>> Which markup language would that be? All versions of HTML/XHTML
>> published since 1997 have required the alt attribute.

>
>I believe Required = "will not work without" it in this case.


Funny definition of required.
Cars work fine without seatbelts but they're still required.

As far as HTML and the alt attribute goes, it entirely depends on
context. If the image isn't loaded, for whatever reason, then the img
element won't work without the alt.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <> <http://steve.pugh.net/>
  Reply With Quote
Old 01-15-2004, 01:47 PM   #9
Whitecrest
 
Posts: n/a
Default Re: Sizing Images

In article <>,
says...
> >I believe Required = "will not work without" it in this case.

> Funny definition of required.
> Cars work fine without seatbelts but they're still required.


But we are not talking about cars are we?

> As far as HTML and the alt attribute goes, it entirely depends on
> context...


That is correct, it depends on the context, and with the original
context, he is correct, it is not required.

--
Whitecrest Entertainment
www.whitecrestent.com
  Reply With Quote
Old 01-15-2004, 02:06 PM   #10
Steve Pugh
 
Posts: n/a
Default Re: Sizing Images

Whitecrest <> wrote:

>In article <>,
>says...
>> >I believe Required = "will not work without" it in this case.

>> Funny definition of required.
>> Cars work fine without seatbelts but they're still required.

>
>But we are not talking about cars are we?


No we're talking about the definition of the word required.

>> As far as HTML and the alt attribute goes, it entirely depends on
>> context...

>
>That is correct, it depends on the context, and with the original
>context, he is correct, it is not required.


What, in your opinion, is the 'original context'?

Are you agreeing with my suggestion that the OP isn't actually talking
about HTML at all, but some other markup language in which the alt
attribute is not required? In which case surely you agree that he
would be better off asking in a non-HTML group?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <> <http://steve.pugh.net/>
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump