C# Class TinyPng.TinyPngClient

Inheritance: IDisposable
Show file Open project: ctolkien/TinyPNG

Public Properties

Property Type Description
httpClient System.Net.Http.HttpClient

Public Methods

Method Description
Compress ( Stream data ) : Task

Compress stream

Compress ( byte data ) : Task

Compress byte array of image

Compress ( string pathToFile ) : Task

Compress file

Dispose ( ) : void
Download ( TinyPngCompressResponse result ) : Task
Resize ( TinyPngCompressResponse result, ResizeOperation resizeOperation ) : Task

Uses the TinyPng API to create a resized version of your uploaded image.

Resize ( TinyPngCompressResponse result, int width, int height, ResizeType resizeType = ResizeType.Fit ) : Task

Uses the TinyPng API to create a resized version of your uploaded image.

SaveCompressedImageToAmazonS3 ( TinyPngCompressResponse result, AmazonS3Configuration amazonSettings, string path ) : Task

Stores a previously compressed image directly into Amazon S3 storage

SaveCompressedImageToAmazonS3 ( TinyPngCompressResponse result, string path, string bucketOverride = "", string regionOverride = "" ) : Task

Stores a previously compressed image directly into Amazon S3 storage

TinyPngClient ( string apiKey ) : System

Wrapper for the tinypng.com API

TinyPngClient ( string apiKey, AmazonS3Configuration amazonConfiguration ) : System

Wrapper for the tinypng.com API

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
CreateContent ( Stream source ) : HttpContent
CreateContent ( byte source ) : HttpContent

Method Details

Compress() public method

Compress stream
public Compress ( Stream data ) : Task
data Stream
return Task

Compress() public method

Compress byte array of image
public Compress ( byte data ) : Task
data byte Byte array of the data to compress
return Task

Compress() public method

Compress file
public Compress ( string pathToFile ) : Task
pathToFile string Path to file on disk
return Task

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

Download() public method

public Download ( TinyPngCompressResponse result ) : Task
result TinyPng.Responses.TinyPngCompressResponse
return Task

Resize() public method

Uses the TinyPng API to create a resized version of your uploaded image.
public Resize ( TinyPngCompressResponse result, ResizeOperation resizeOperation ) : Task
result TinyPng.Responses.TinyPngCompressResponse This is the previous result of running a compression
resizeOperation ResizeOperation Supply a strongly typed Resize Operation. See , , ,
return Task

Resize() public method

Uses the TinyPng API to create a resized version of your uploaded image.
public Resize ( TinyPngCompressResponse result, int width, int height, ResizeType resizeType = ResizeType.Fit ) : Task
result TinyPng.Responses.TinyPngCompressResponse This is the previous result of running a compression
width int
height int
resizeType ResizeType
return Task

SaveCompressedImageToAmazonS3() public method

Stores a previously compressed image directly into Amazon S3 storage
public SaveCompressedImageToAmazonS3 ( TinyPngCompressResponse result, AmazonS3Configuration amazonSettings, string path ) : Task
result TinyPng.Responses.TinyPngCompressResponse The previously compressed image
amazonSettings AmazonS3Configuration The settings for the amazon connection
path string The path and bucket to store in: bucket/file.png format
return Task

SaveCompressedImageToAmazonS3() public method

Stores a previously compressed image directly into Amazon S3 storage
public SaveCompressedImageToAmazonS3 ( TinyPngCompressResponse result, string path, string bucketOverride = "", string regionOverride = "" ) : Task
result TinyPng.Responses.TinyPngCompressResponse The previously compressed image
path string The path to storage the image as
bucketOverride string Optional: To override the previously configured bucket
regionOverride string Optional: To override the previously configured region
return Task

TinyPngClient() public method

Wrapper for the tinypng.com API
public TinyPngClient ( string apiKey ) : System
apiKey string Your tinypng.com API key, signup here: https://tinypng.com/developers
return System

TinyPngClient() public method

Wrapper for the tinypng.com API
public TinyPngClient ( string apiKey, AmazonS3Configuration amazonConfiguration ) : System
apiKey string Your tinypng.com API key, signup here: https://tinypng.com/developers
amazonConfiguration AmazonS3Configuration Configures defaults to use for storing images on Amazon S3
return System

Property Details

httpClient public property

public HttpClient,System.Net.Http httpClient
return System.Net.Http.HttpClient