5.1.0 • Published 1 year ago

shareimage v5.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ShareImage

Card

Installation

There is currently 2 Langauges Supported: Python and Node.js And there is a API available to use with your project!

API (Beta)

The API is currently in beta and may have some issues. The domain of the API is https://shimg.zype.cf/v1 Currently, the V2 of ShareImage is only available for the Node.JS Library (with CommonJS, ESM and TypeScript support)

Endpoints

There is currently only one endpoint available:

GET /image

It needs Query Params in the following format: https://shimg.zype.cf/v1/image?paramName=paramValue The paramaters are as same as Node.js Params!

Python

To Install ShareImage in Python with PIP Run:

pip install ShareImage

Node.js

To Install ShareImage in Node.js with NPM Run:

npm i shareimage --save

Or, with Yarn:

yarn add shareimage

Usage

Using ShareImage is a bit different across Languages.

Python

Use the Following Code to Generate a Image and print it's URL in Python:

from ShareImage import ShareImage

image = ShareImage(
    title = "My Test Image",
    cloudName = "myCloud",
    imagePublicId = "myFolder/myImage"
)

print(image)

Node.js

Use the Following Code to Generate a Image and output it's URL in Node.js (ES6):

import * as ShareImage from 'shareimage';

const image = await ShareImage.generateImage(
    "/path/to/image.png",
    "My awesome title",
    { type: "datauri" }
)

console.log(image)

Parameters

There are only 2 Required Parameters and several optional params.

Required Parameters

ParameterTypeDescription
srcStringURL/Buffer of the Image
titleStringTitle of the Image

Optional Parameters

output Object (3rd parameter)

ParameterTypeDefaultDescription
typeStringbase64The format of the output. Can be buffer, datauri, base64, or file (Save the file in FS). This option is necessary but comes with default value.
optionsObject{}This option is necessary if type is set to file. The structure of the options Object is {options: {file: {path: "/file/to/output.png"}}}

props Object (4th parameter)

ParameterTypeDefaultDescription
taglineStringNoneTagline of Website or Tags of Post
titleFontShareFontsirin-stencilFont of Title
titleExtraConfigString''Extra Title Config
taglineExtraConfigString''Extra Config of Tagline
taglineFontShareFontarialFont of Tagline
imageWidthNumber1280Width of Image
imageHeightNumber669Height of Image
textAreaWidthNumber760Width of TextArea
textLeftOffsetNumber480Left Offset of Text
titleGravityStringsouth_westGravity of Title
taglineGravityStringnorth_westGravity of Tagline
titleLeftOffsetNumberNoneLeft Offset of Title
taglineLeftOffsetNumberNoneLeft Offset of Tagline
titleBottomOffsetNumber254Bottom Offset of Title
taglineTopOffsetNumber445Top Offset of Tagline
textColorString000000Color of Text
titleColorStringNoneColor of Title (If not provided textColor will be used instead
taglineColorStringNoneColor of Tagline (If not provided textColor will be used instead
titleFontSizeNumber64Font Size of Title
taglineFontSizeNumber48Font Size of Tagline

Note: If you don't provide Tagline, Parameters with tagline Prefix will be ignored.
We may add more Customization to ShareImage in the Future.

Sponsors

We have been sponsored by Vercel, MacStadium.
Vercel gave us free Pro Plan access to host the documentation and other websites.
MacStadium gave us free Mac Mini Server to host the API and for builds.

Powered By Vercel

5.1.0

1 year ago

5.0.0

1 year ago

1.5.0

2 years ago

2.0.3

2 years ago

2.2.0

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.4.7

2 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-beta.0

3 years ago