HawkXP71 116 Posted yesterday at 01:49 AM Posted yesterday at 01:49 AM I am moving some code from JS that currently runs inside a js page. The current code is var serverId = "...."; // a valid server Id var imageid = "....."; // a valid image id var imageUrl = ApiClient.getImageUrl( imageId, { type: "Primary", quality: 90 } ) return "<<a is="emby-linkbutton" href="/item?id=` + imageId + `&serverId=` + serverId + `"><img src="` + imageUrl + `" height="200px" alt="` + v.Name + `" /></a>`; I am trying to get the same exact url from C# function calls. I have access to all the globals created during the service construction. Thanks in advance Scott
HawkXP71 116 Posted 35 minutes ago Author Posted 35 minutes ago Solved.. Not sure if its the ONLY solution, I would love an answer from @softworkzor @Luke string itemid = ....; BaseItem item = = _libraryManager.GetItemById(itemid); ImageType imageType = ImageType.Primary; // or whichever image type you want int imageIndex = 0; int quality = 90; var imageType = Image.Primary; if ( !item.HasImage( imageType, 0 ) ) return null; var imageInfo = item.GetImageInfo(imageType, imageIndex ); if ( imageInfo == null ) return null; var imageTag = imageInfo?.DateModified.Ticks.ToString(); var imageUrl = $"/emby/Items/{item.Id}/Images/{imageType}?maxWidth={maxWidth}&quality={quality}&tag={imageTag}";
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now