I have tried to place the dimension attributes i.e width and height with the static values of the image cropper , but on inspect the img tag element neither of them appears.
If the image cropper data type is placed directly on the node being rendered. However if the image cropper is being used from the media section you will first have to access the media content, ie:
Get the width and height of an image cropper as per https://gtmetrix.com/specify-image-dimensions.html
Happy Friday everyone,
I am looking a way to display the height and width inside the img tag for a cropped image , following this article https://gtmetrix.com/specify-image-dimensions.html
I have tried to place the dimension attributes i.e width and height with the static values of the image cropper , but on inspect the img tag element neither of them appears.
However if i place a rel attribute, on inspecting the img tag, the rel attributes does appear
Thanks you very much for kind responses and help,
Hey Preetee,
If you would like to specify the dimensions you could try the following code:
If the image cropper data type is placed directly on the node being rendered. However if the image cropper is being used from the media section you will first have to access the media content, ie:
If you have a crop size specified in the backend then you can change the hard coded crop to something like this:
be sure to change the "image" out with the alias stored against the image cropper.
Hope this helps :) (this method also only works in umbraco version 7.3.5+)
is working on a reply...