Sizing Images

A

Allen Flick

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
 
L

Leif K-Brooks

Allen said:
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.
 
A

Allen Flick

Leif said:
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.


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.
 
J

Joel Shepherd

Allen said:
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.
 
A

Allen Flick

Joel said:
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.


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.

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?
 
S

Steve Pugh

Allen Flick said:
"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?
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
 
W

Whitecrest

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.
 
S

Steve Pugh

Whitecrest said:
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
 
W

Whitecrest

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.
 
S

Steve Pugh

Whitecrest said:
But we are not talking about cars are we?

No we're talking about the definition of the word required.
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
 
A

Allen Flick

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

Just as all versions of HTML/XHTML "require" the <i> attribute.
The difference is that it's *required* in the language, but it is *not
required* for a user like me to use it.

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

So, if this newsgroup is for developers of HTML, and not for users of
same, then you're probably right, I need to find another newsgroup.
Got any idea where it is?
 
L

Lauri Raittila

In said:
Just as all versions of HTML/XHTML "require" the <i> attribute.

That statement above is false
1. only¹ tags that are required by all HTML specs are <title> and
</title>. And as title element doesn't have any attributes, there is
no attribute that must be used in HTML.
2. <i> is not attribute, it's tag. The difference is significant - you
can choose not to use alt attribute - but then you must not use img
element either (or area etc.).
3. user agents aren't required to implement i element any way, IIANM.
The difference is that it's *required* in the language, but it is *not
required* for a user like me to use it.

No. alt attribute and title element are both required for you to use when
stated. If you don't use them, you are not using HTML.

Of course you may choose to not do required thing. In web, it has little
consequenses in most jurisdictions (but not all).

In real life, you can ignore required max cruising speed on certain road.
That don't hurt you, unless you drive out of road or get speeding ticket.
In real live, speeding ticket is used so that you would not kill/hurt
yourself, as it may cause lots of expences to others when you do. Just
like missing alt text - you cause yourself problem of having smaller
audience, and same time make live of those who find your page possibly
unmeaningful.
So, if this newsgroup is for developers of HTML,
and not for users of
same,

It says exactly that this group is for users of HTML/XHTML. It also says
that this group is not for something else. OTOH, I this group also does
tag-soup, as this group is not purely for HTML and XHTML but for www.

But, this groups is not tolerating tag-soup just because you are lazy or
stupid. Tag-soup is tolerated only when it is only option. (it never is
good option)
then you're probably right, I need to find another newsgroup.

I suggest alt.dev.null for you. I believe you can talk about everything
there. I might be wrong though.

[1] that doesn't mean that some other markup/content than title element
wouldn't be required, but that the thing isn't specified.
 
S

Steve Pugh

Allen Flick said:
Just as all versions of HTML/XHTML "require" the <i> attribute.

No they include it.
They do not require that it is used in any particular document.
The difference is that it's *required* in the language, but it is *not
required* for a user like me to use it.

Correct you are not required to use the <i> element in any particular
document.
But that is a totally different case to the alt attribute. Read the
specification. Every time you use an <img> element you are required
include the alt attribute.

So, if this newsgroup is for developers of HTML, and not for users of
same, then you're probably right, I need to find another newsgroup.
Got any idea where it is?

I don't know what your markup language is called, maybe is you
searched for that then you'd find a newsgroup dedicated to it.

If you want to talk about HTML instead then this is one of the right
places.

Steve
 
T

Toby A Inkster

Allen said:
Just as all versions of HTML/XHTML "require" the <i> attribute.

The difference is that it's *required* in the language, but it is *not
required* for a user like me to use it.

The alt attribute is required for every <img> element. Of course, you can
have a page with no <img> elements, in which case the writer needn't use
any alt attributes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top