Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi there,
when I create a new image, I pass attributes, categories, status and tags to it.
Attributes and categories are associated correctly, but no Tag is added to my image.
This is the code:
....
Image image = new Image(MyPageHandler.Instance.GetMyPage(CurrentUser).ImageGallery,("ExternalId", (tempContent as ContData).GetExternalId());
"content_" + Session[SessionKey_TempPosterID],
GlobalHelper.Translate("/imagedescription"), new UserAuthor(CurrentUser),
new System.IO.MemoryStream(
Convert.FromBase64String(valueimg.Value.Replace("data:image/jpeg;base64,",
string.Empty))));
image.Status = EntityStatus.Pending;
image.SetAttributeValue
var catSelected = CategoryHandler.Instance.GetCategory(int.Parse(category.SelectedValue));
image.Categories.Add(catSelected);
// **** ADD TAG ***
string currentLanguage="en";
var ImgLocaleTags = TagHandler.Instance.GetPredefinedTags(typeof(EPiServer.Community.ImageGallery.Image), null, null);
foreach(var item in ImgLocaleTags){
if(item.Tag.Name.Equals(currentLanguage))
image.Tags.Add(item.Tag); // <== in debug item.tag but seems that nothing is added to image>
}
// *******
var savedImage = ImageGalleryHandler.Instance.AddImage(image);
...
Any idea?
Thank you.