Can I add an altText property to the Image media type?
Hello,
Completely inexperienced with Umbraco and in web development in general, so I hope my question isn't silly and that I manage to get it across:
I want to add an altText as a mandatory property to the Image media type, so that whenever the content creator uploads an image they're prompted to input a description (which I can later pass into the 'alt' attribute in my templates). Adding the property to the media type is easy, but it doesn't have any effect on the image upload process - there's no prompt to input text.
Is there a way to make it work (or maybe some better way to make adding a description mandatory as part of the upload process)?
Thanks!
From Umbraco backoffice, you can click on Settings, Open media type, then select Image
Them click on Add Propery, enter a name for it "let's assume Alt Text", then click on Select Editor
Assuming it will be a text input, Search for "text" and then select text string, then click on Submit.
After submitting you will notice that the property has been added to the Image type, Click save
Now all your existing images and newly created images will have the field Alt text
After that all what you need is to read this property in your template which most probable will be "altText" if you named the new property "Alt Text", notice the text in front of the lock icon under the property name field.
Just read the property in the template and put its value in the alt tag in the image tag
Hello Ahmed, thanks for the detailed reply.
From what I can tell, this dialogue box only presents within the Media section of the Umbraco back office. However, when I use a media picker in the Content section to upload an image this dialogue box doesn't appear, the image is simply added to the folder. I expect my users to use the media picker almost exclusively, so the fact that the property is visible in the Media section is not really useful. Also, not only is this property difficult to get to, it's requirement as 'mandatory' is bypassed by uploading the image in the Content section.
It seems like a sort of bug, doesn't it? I guess I could work around it by using compositions comprising a media picker and a text box instead of embedding the text box into the media picker. Any other ideas?
By the way, I'm using Umbraco 13.5.1, maybe this problem has been fixed in v14?
Can I add an altText property to the Image media type?
Hello, Completely inexperienced with Umbraco and in web development in general, so I hope my question isn't silly and that I manage to get it across: I want to add an altText as a mandatory property to the Image media type, so that whenever the content creator uploads an image they're prompted to input a description (which I can later pass into the 'alt' attribute in my templates). Adding the property to the media type is easy, but it doesn't have any effect on the image upload process - there's no prompt to input text. Is there a way to make it work (or maybe some better way to make adding a description mandatory as part of the upload process)? Thanks!
Hello Tom,
From Umbraco backoffice, you can click on Settings, Open media type, then select Image
Them click on Add Propery, enter a name for it "let's assume Alt Text", then click on Select Editor
Assuming it will be a text input, Search for "text" and then select text string, then click on Submit.
After submitting you will notice that the property has been added to the Image type, Click save
Now all your existing images and newly created images will have the field Alt text
After that all what you need is to read this property in your template which most probable will be "altText" if you named the new property "Alt Text", notice the text in front of the lock icon under the property name field.
Just read the property in the template and put its value in the alt tag in the image tag
Hello Ahmed, thanks for the detailed reply. From what I can tell, this dialogue box only presents within the Media section of the Umbraco back office. However, when I use a media picker in the Content section to upload an image this dialogue box doesn't appear, the image is simply added to the folder. I expect my users to use the media picker almost exclusively, so the fact that the property is visible in the Media section is not really useful. Also, not only is this property difficult to get to, it's requirement as 'mandatory' is bypassed by uploading the image in the Content section. It seems like a sort of bug, doesn't it? I guess I could work around it by using compositions comprising a media picker and a text box instead of embedding the text box into the media picker. Any other ideas? By the way, I'm using Umbraco 13.5.1, maybe this problem has been fixed in v14?
Thanks again, Tom
is working on a reply...