Added Image Media via code not showing in Umbraco Admin panel
Hi Team,
I have added Images in Umbraco Media using the code. Folder and Subfolder are created successfully and Images also...but Images are not showing in Admin panel.
Below is the code which i am using...help me if i am doing something wrong.
IMedia? _userProfilefolder = _mediaService.GetRootMedia().FirstOrDefault(m => m.Name.InvariantEquals("UserProfile"));
if (_userProfilefolder == null)
{
_userProfilefolder = _mediaService.CreateMediaWithIdentity("UserProfile", Constants.System.Root, MediaTypes.Folder);
}
IMedia? usernameFolder = _mediaService.GetPagedChildren(_userProfilefolder.Id, 0, int.MaxValue, out var folderCount)
.Where(x => x.ContentType.Alias == Constants.Conventions.MediaTypes.Folder)
.FirstOrDefault(c => c.Name.InvariantEquals(username));
if (usernameFolder == null)
{
usernameFolder = _mediaService.CreateMediaWithIdentity(username, _userProfilefolder.Id, MediaTypes.Folder);
}
await using (var ms = new MemoryStream())
{
await file.CopyToAsync(ms);
var media = _mediaService.CreateMedia("ProfilePic2.jpg", usernameFolder.Id, Constants.Conventions.MediaTypes.Image);
media.SetValue(_mediaFileManager, _mediaUrlGenerators, _shortStringHelper, _contentTypeBaseServiceProvider, Constants.Conventions.Media.File, "ProfilePic2.jpg", ms);
_mediaService.Save(media);
}
Just to update everything is fine...but issue is that...I am storing the Media using the API, which is another application not the CMS application it self.
So i just want to know...how to setup the application URL and Media path in api application for CMS application.
Added Image Media via code not showing in Umbraco Admin panel
Hi Team,
I have added Images in Umbraco Media using the code. Folder and Subfolder are created successfully and Images also...but Images are not showing in Admin panel.
Below is the code which i am using...help me if i am doing something wrong.
Hi Team,
Just to update everything is fine...but issue is that...I am storing the Media using the API, which is another application not the CMS application it self.
So i just want to know...how to setup the application URL and Media path in api application for CMS application.
is working on a reply...