Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting image from Uri #47

Closed
yuyuki opened this issue Jul 16, 2014 · 1 comment
Closed

Getting image from Uri #47

yuyuki opened this issue Jul 16, 2014 · 1 comment

Comments

@yuyuki
Copy link

yuyuki commented Jul 16, 2014

Hi,

As I say, It would be great to retrieve image from Uri.

If you want I can help you. I can make a pull request and if it's good for you, you can integrate my job to yours.

I will make Unit Test of course.

Thank you,

@LordMike
Copy link
Collaborator

Hi,

There are a few reasons why I haven't implemented a direct GetImage(), rather than a GetImageUri(). Basically, I'm trying to keep a clean interface, where as little as possible can go wrong. The amount of different ways to do a GetImage() function is huge (return types, caching, proxy-handling, threading, ...), so I almost every case I'd either hit new issues or find people working around it because "It caches in C:\Temp and we're running on linux"...

Instead, I'd propose that you extend the Client class yourself, using an extension method. You could even Subclass the thing if you so wished :). Here's an example to get you (or others) started.

public static class ClientExtensions
{
    public static byte[] GetImage(this TMDbClient client, string size, string filePath, bool useSsl)
    {
        return new WebClient().DownloadData(client.GetImageUrl(size, filePath, useSsl));
    }
}

Oh yea, adding a System.Drawing.Image reference, also requires System.Drawing. So we'd break some compatibility somewhere :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants