@jlengstorf/get-share-image
Advanced tools
Comparing version 0.7.1 to 0.7.2-beta.0
@@ -1,10 +0,46 @@ | ||
interface Config { | ||
title: string; | ||
tagline?: string; | ||
cloudName: string; | ||
imagePublicID: string; | ||
/** | ||
* @typedef Config | ||
* @prop {string} title | ||
* @prop {string} [tagline] | ||
* @prop {string} cloudName | ||
* @prop {string} imagePublicID | ||
* @prop {string} [cloudinaryUrlBase] | ||
* @prop {string} [titleExtraConfig] | ||
* @prop {string} [taglineExtraConfig] | ||
* @prop {string} [titleFont] | ||
* @prop {string} [taglineFont] | ||
* @prop {number} [imageWidth] | ||
* @prop {number} [imageHeight] | ||
* @prop {number} [textAreaWidth] | ||
* @prop {number} [textLeftOffset] | ||
* @prop {string} [titleGravity] | ||
* @prop {string} [taglineGravity] | ||
* @prop {number} [titleLeftOffset] | ||
* @prop {number} [taglineLeftOffset] | ||
* @prop {number} [titleBottomOffset] | ||
* @prop {number} [taglineTopOffset] | ||
* @prop {string} [textColor] | ||
* @prop {string} [titleColor] | ||
* @prop {string} [taglineColor] | ||
* @prop {number} [titleFontSize] | ||
* @prop {number} [taglineFontSize] | ||
* @prop {string} [version] | ||
*/ | ||
/** | ||
* Generates a social sharing image with custom text using Cloudinary’s APIs. | ||
* | ||
* @see https://cloudinary.com/documentation/image_transformations#adding_text_captions | ||
* | ||
* @param {Config} config | ||
* @return {string} | ||
*/ | ||
export default function generateSocialImage({ title, tagline, cloudName, imagePublicID, cloudinaryUrlBase, titleFont, titleExtraConfig, taglineExtraConfig, taglineFont, imageWidth, imageHeight, textAreaWidth, textLeftOffset, titleGravity, taglineGravity, titleLeftOffset, taglineLeftOffset, titleBottomOffset, taglineTopOffset, textColor, titleColor, taglineColor, titleFontSize, taglineFontSize, version, }: { | ||
title: any; | ||
tagline: any; | ||
cloudName: any; | ||
imagePublicID: any; | ||
cloudinaryUrlBase?: string; | ||
titleFont?: string; | ||
titleExtraConfig?: string; | ||
taglineExtraConfig?: string; | ||
titleFont?: string; | ||
taglineFont?: string; | ||
@@ -17,19 +53,12 @@ imageWidth?: number; | ||
taglineGravity?: string; | ||
titleLeftOffset?: number; | ||
taglineLeftOffset?: number; | ||
titleLeftOffset?: any; | ||
taglineLeftOffset?: any; | ||
titleBottomOffset?: number; | ||
taglineTopOffset?: number; | ||
textColor?: string; | ||
titleColor?: string; | ||
taglineColor?: string; | ||
titleColor: any; | ||
taglineColor: any; | ||
titleFontSize?: number; | ||
taglineFontSize?: number; | ||
version?: string; | ||
} | ||
/** | ||
* Generates a social sharing image with custom text using Cloudinary’s APIs. | ||
* | ||
* @see https://cloudinary.com/documentation/image_transformations#adding_text_captions | ||
*/ | ||
export default function generateSocialImage({ title, tagline, cloudName, imagePublicID, cloudinaryUrlBase, titleFont, titleExtraConfig, taglineExtraConfig, taglineFont, imageWidth, imageHeight, textAreaWidth, textLeftOffset, titleGravity, taglineGravity, titleLeftOffset, taglineLeftOffset, titleBottomOffset, taglineTopOffset, textColor, titleColor, taglineColor, titleFontSize, taglineFontSize, version, }: Config): string; | ||
export {}; | ||
version?: any; | ||
}): string; |
34
index.js
"use strict"; | ||
/** | ||
* @typedef Config | ||
* @prop {string} title | ||
* @prop {string} [tagline] | ||
* @prop {string} cloudName | ||
* @prop {string} imagePublicID | ||
* @prop {string} [cloudinaryUrlBase] | ||
* @prop {string} [titleExtraConfig] | ||
* @prop {string} [taglineExtraConfig] | ||
* @prop {string} [titleFont] | ||
* @prop {string} [taglineFont] | ||
* @prop {number} [imageWidth] | ||
* @prop {number} [imageHeight] | ||
* @prop {number} [textAreaWidth] | ||
* @prop {number} [textLeftOffset] | ||
* @prop {string} [titleGravity] | ||
* @prop {string} [taglineGravity] | ||
* @prop {number} [titleLeftOffset] | ||
* @prop {number} [taglineLeftOffset] | ||
* @prop {number} [titleBottomOffset] | ||
* @prop {number} [taglineTopOffset] | ||
* @prop {string} [textColor] | ||
* @prop {string} [titleColor] | ||
* @prop {string} [taglineColor] | ||
* @prop {number} [titleFontSize] | ||
* @prop {number} [taglineFontSize] | ||
* @prop {string} [version] | ||
*/ | ||
exports.__esModule = true; | ||
@@ -8,2 +36,5 @@ /** | ||
* https://support.cloudinary.com/hc/en-us/articles/202521512-How-to-add-a-slash-character-or-any-other-special-characters-in-text-overlays- | ||
* | ||
* @param {string} text | ||
* @return {string} | ||
*/ | ||
@@ -17,2 +48,5 @@ function cleanText(text) { | ||
* @see https://cloudinary.com/documentation/image_transformations#adding_text_captions | ||
* | ||
* @param {Config} config | ||
* @return {string} | ||
*/ | ||
@@ -19,0 +53,0 @@ function generateSocialImage(_a) { |
{ | ||
"name": "@jlengstorf/get-share-image", | ||
"version": "0.7.1", | ||
"version": "0.7.2-beta.0", | ||
"main": "index.js", | ||
"module": "index.mjs", | ||
"exports": { | ||
"import": "./index.mjs", | ||
"require": "./index.js" | ||
}, | ||
"author": "Jason Lengstorf <jason@lengstorf.com> (https://lengstorf.com)", | ||
@@ -12,3 +17,5 @@ "license": "MIT", | ||
"scripts": { | ||
"build": "tsc src/index.ts --outDir . -d", | ||
"build:cjs": "tsc src/index.ts --outDir . -d", | ||
"build:esm": "cpy ./src/index.ts . --rename=index.mjs", | ||
"build": "yarn build:cjs && yarn build:esm", | ||
"prepublish": "npm run build" | ||
@@ -22,4 +29,5 @@ }, | ||
"devDependencies": { | ||
"typescript": "^3.7.4" | ||
"cpy-cli": "^3.1.1", | ||
"typescript": "^4.0.5" | ||
} | ||
} |
# Generate Social Media Images Using Cloudinary | ||
This is a utility function that builds social media images by overlaying a title and tagline over an image using [Cloudinary’s APIs](https://cloudinary.com/documentation/image_transformations#adding_text_captions). | ||
This is a utility function that builds social media images by overlaying a title and tagline over an image using [Cloudinary’s APIs](https://cloudinary.com/documentation/image_transformations?ap=lwj#adding_text_captions). | ||
@@ -34,3 +34,4 @@ > **NOTE:** a Cloudinary account is required to use this package. The free tier should be more than enough for most small to medium websites using this package. [Sign up for an account here!](https://jason.af/cloudinary) | ||
imagePublicID: 'lwj/blog-post-card', | ||
font: 'futura', | ||
titleFont: 'futura', | ||
taglineFont: 'futura', | ||
textColor: '232129', | ||
@@ -37,0 +38,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14991
168
103
2