Try our conversational search powered by Generative AI!

How to autofulfill title and alt on image selection after Select Content dialog submission?

Vote:
 

I would like know how to autofulfill image properties title and alt on picture choose in Insert/Edit Image dialog window as is foreshadowed in following pictures.

Image choose dialog

Insert/Edit Image dialog

#183124
Edited, Oct 05, 2017 14:57
Vote:
 

you can subsribe to ContentSaving event and alter image data there.

[InitializableModule]
[ModuleDependency(typeof(InitializationModule))]
public class ImgProcessingSetup : IInitializableModule
{
	public void Initialize(InitializationEngine context)
	{
		var emitter = ServiceLocator.Current.GetInstance<IContentEvents>();
		emitter.CreatedContent += OnImageCreated;
	}

	public void Uninitialize(InitializationEngine context)
	{
		var emitter = ServiceLocator.Current.GetInstance<IContentEvents>();
		emitter.CreatedContent -= OnImageCreated;
	}

	private void OnImageCreated(object sender, ContentEventArgs args)
	{
		// do the magic here
	}
}
#183213
Oct 08, 2017 11:58
Vote:
 

        

Thanks for advice but I am affraid there are neither in sender nor args accesible properties or fields relevant to description (img attribute alt) and title (img attribute title).


There is a file image.js (image.js.uncompressed.js) where exist property updateImageData in variable ImageDialog like code beneath.

updateImageData : function() {
		var f = document.forms[0], t = ImageDialog;

		if (f.width.value == "")
			f.width.value = t.preloadImg.width;

		if (f.height.value == "")
			f.height.value = t.preloadImg.height;
	},


I need de facto the same functionality but for setting the description (alt) and title (title). There is laso tinyMCEPopup class with onInit event that could server for this purpose.

#183219
Edited, Oct 09, 2017 9:30
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.