Okay
  Public Ticket #2344749
Output of the image's width and height values
Closed

Comments

  • Stefano started the conversation

    Hello, in a custom widget with the image item, how can I output in the html img tag the image's width and height px values?

  •  1,173
    Amit replied

    u can add a width attribute using the number attribute - there is no attribute to output the width from the image original size 

  • Stefano replied

    Hello Amit, I hope your are fine!

    If I want to change the width of the image yes, I can do like you suggest.
    But I need only to print in the <a tag>  the original width/height of the image.
    <img src="{{item.image_thumb}}" alt="{{item.image_alt}}" width="{{item.image_width}}" height="{{item.image_height}}">

    There is the "item.image_alt" attribute, I would need the same attribute for width and height.

  •  1,173
    Amit replied

    you can create a width and height attribute in attributes 


  • Stefano replied

    I don't want to let user to change image width/height values, I only need to get the original values from the image.
    Like src or alt 

    <img src="{{item.image_thumb}}" alt="{{item.image_alt}}" width="{{item.image_width}}" height="{{item.image_height}}">

    Thanks for your support
    Stefano

  •  1,173
    Amit replied

    we dont have this feature. 

    but if u put an image in the html its size should not change it should be in its original size without adding this attributes manually

  • Stefano replied

    Please consider to add it when possible, thanks.

    According to W3C:

    The height and width attributes give user agents an idea of the size of an image or object so that they may reserve space for it and continue rendering the document while waiting for the image data.
    https://www.w3.org/TR/html401/struct/objects.html#adef-height-IMG

  •   Max replied privately
  • Stefano replied

    Thank you! I will try and I will let you know

  • Stefano replied

    Hello,
    I've updated the plugin with the version you provided to me, but I do not find the width/height attributes for the image item.

    What I wrong?
    Please see the attached screenshots.

    One is the detail of the item attribute image type; the other is the html, where in the right column I do not find available the new attributes.

  •   Max replied privately
  •   Max replied privately