Jump to content

How would I implement the ImageProvider in such different scence?


kwangsing
Go to solution Solved by Luke,

Recommended Posts

kwangsing

Hi All,  I'm searching and try to figure out how to make a C# plugin in Emby, and had some different situation with the same topic.   I'll try to explain them clearly.

First I had a "CustomClass"  would handle and request all the Metadata I wanted, including Images and other detail of the movie.

 

Here's the question

1.   I implemented an ImageProvider inherited from IRemoteImageProvider , and be able to work if I just pass the URL in GetImages,   

If I try to return a fake HttpResponse and replace the Content I edited,   it would still try to visit the url I gave (like url = "post.jpg") and cause Error.(exceptions No file Found )   I need to crop the image after I received the image actually.

 

2.  And It brings other issue here,   other  MediaBrowser.Controller.Providers like  IDynamicImageProvider,   or  ILocalImageProvider  may not works in this case?  my cropped image only in memory (as byte[] BTW) , also none of them could return multiple imageType as IRemoteImageProvider.  (GetImages method has no IEnumerable on return).

image.png.bb7a0ed9cce3f090ec866218d9ed7cfa.png

most important is I tryed this below  and IDynamicImageProvider  part do nothing.   (I pass the ImageType.Primrary and the stream of image).      ignore the error : P

image.png.92f68f050088e9b00a9104d645d0a681.png

 

3.   I had a annoy issue with backdrop image part, every time I click view  and it would keep adding new image, How would I fix this issue ?

image.png.b91ad1529b4032e7c82e1b3f65c5013d.png

here's the code:

image.thumb.png.3d5e1bfc1befc0b0332521588e728ba1.png

Edited by kwangsing
fix some words
Link to comment
Share on other sites

Hi, if you just want to provide a remote image from a url, then you're doing the right thing by implementing IRemoteImageProvider .

Link to comment
Share on other sites

kwangsing

@Luke Hi Luke,    How about cropped images?     

My Image from Internet,

I saved my cropped images as byte[] in memery first, and I gave a special words in url , then I should knew when to return a fake HttpResponseInfo instead of make a remote request.

But the true is, Emby core still make a request and cause Error (Invaild URI or No such File Found).  how could I avoid that ?

image.png.e80164c1b1fc483fa1736d4583da38fd.png

Edited by kwangsing
Link to comment
Share on other sites

GetImageResponse is actually not really used anymore, unless the user has enabled downloading images in advance and the image gets downloaded immediately.

Otherwise, the url you returned just gets recorded in the database and then downloaded separately later once it's needed.

Link to comment
Share on other sites

kwangsing

@Luke  Then how should I feed a image from byte[] or stream not URL after all? 
 IDynamicImageProvider  looks like a good start,  when I inherited them together,  IDynamicImageProvider  part  do nothing.

image.png.073bdc34bfe7dfd830a198a9c2e3e7e5.png

Edited by kwangsing
Link to comment
Share on other sites

  • Solution
32 minutes ago, kwangsing said:

@Luke  Then how should I feed a image from byte[] or stream not URL after all? 
 IDynamicImageProvider  looks like a good start,  when I inherited them together,  IDynamicImageProvider  part  do nothing.

image.png.073bdc34bfe7dfd830a198a9c2e3e7e5.png

You'd have to just implement IDynamicImageProvider.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...