HawkXP71 116 Posted Wednesday at 01:49 AM Posted Wednesday 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 22 hours ago Author Posted 22 hours 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}";
HawkXP71 116 Posted 1 hour ago Author Posted 1 hour ago 20 hours ago, Luke said: That will work. Is there a better way? The main concern is the URL is being constructed by me, I was hoping there was an API i could call to get it.
Luke 42920 Posted 1 hour ago Posted 1 hour ago On the server there aren’t any helpers to do that. On the client there are. 1
HawkXP71 116 Posted 1 hour ago Author Posted 1 hour ago 16 minutes ago, Luke said: On the server there aren’t any helpers to do that. On the client there are. Thanks
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