Sizing Images

Discussion in 'HTML' started by Allen Flick, Jan 7, 2004.

  1. Allen Flick

    Allen Flick Guest

    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, Jan 7, 2004
    #1
    1. Advertising

  2. 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.
     
    Leif K-Brooks, Jan 7, 2004
    #2
    1. Advertising

  3. Allen Flick

    Allen Flick Guest

    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.
     
    Allen Flick, Jan 12, 2004
    #3
  4. 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.
     
    Joel Shepherd, Jan 12, 2004
    #4
  5. Allen Flick

    Allen Flick Guest

    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?
     
    Allen Flick, Jan 14, 2004
    #5
  6. Allen Flick

    Steve Pugh Guest

    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/>
     
    Steve Pugh, Jan 15, 2004
    #6
  7. Allen Flick

    Whitecrest Guest

    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
     
    Whitecrest, Jan 15, 2004
    #7
  8. Allen Flick

    Steve Pugh Guest

    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/>
     
    Steve Pugh, Jan 15, 2004
    #8
  9. Allen Flick

    Whitecrest Guest

    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
     
    Whitecrest, Jan 15, 2004
    #9
  10. Allen Flick

    Steve Pugh Guest

    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/>
     
    Steve Pugh, Jan 15, 2004
    #10
  11. Allen Flick

    Whitecrest Guest

    In article <>,
    says...
    > >But we are not talking about cars are we?

    > No we're talking about the definition of the word required.
    > Are you agreeing...


    I was agreeing with you that definition depends on context.

    --
    Whitecrest Entertainment
    www.whitecrestent.com
     
    Whitecrest, Jan 15, 2004
    #11
  12. Allen Flick

    Allen Flick Guest

    Steve Pugh wrote:

    > 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?
     
    Allen Flick, Jan 15, 2004
    #12
  13. In article Allen Flick wrote:
    > Steve Pugh wrote:
    >
    > > 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.


    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.

    > > 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,


    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.

    --
    Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
    Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
    tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.
     
    Lauri Raittila, Jan 15, 2004
    #13
  14. Allen Flick

    Steve Pugh Guest

    Allen Flick <> wrote:

    >Steve Pugh wrote:
    >
    >> 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.


    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.

    If you use an <img> element without an alt attribute then you are not
    writing HTML. HTH

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


    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

    --
    "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/>
     
    Steve Pugh, Jan 15, 2004
    #14
  15. Allen Flick wrote:

    > Steve Pugh wrote:
    >
    >> 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.


    <i> is an element, not an 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.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Jan 15, 2004
    #15
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James O'Riley

    Sizing background images

    James O'Riley, May 2, 2006, in forum: HTML
    Replies:
    6
    Views:
    3,974
    Toby Inkster
    May 3, 2006
  2. dorayme
    Replies:
    0
    Views:
    390
    dorayme
    Feb 20, 2009
  3. MISS CHIEVOUS
    Replies:
    51
    Views:
    2,118
    MISS CHIEVOUS
    Apr 19, 2009
  4. Jeff

    problem sizing images

    Jeff, Apr 3, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    334
    Alexey Smirnov
    Apr 13, 2009
  5. Jimbo
    Replies:
    0
    Views:
    155
    Jimbo
    Jan 12, 2004
Loading...

Share This Page