November Happy Hour will be moved to Thursday December 5th.
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, "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("ExternalId", (tempContent as ContData).GetExternalId());
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.
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.