GithubHelp home page GithubHelp logo

Getting image from Uri about tmdblib HOT 1 CLOSED

jellyfin avatar jellyfin commented on May 20, 2024
Getting image from Uri

from tmdblib.

Comments (1)

LordMike avatar LordMike commented on May 20, 2024

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

from tmdblib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.