@jlengstorf/get-share-image
Advanced tools
Comparing version 0.3.0 to 0.4.0
interface Config { | ||
title: string; | ||
tagline: string; | ||
tagline?: string; | ||
cloudName: string; | ||
@@ -5,0 +5,0 @@ imagePublicID: string; |
23
index.js
@@ -10,5 +10,4 @@ "use strict"; | ||
function cleanText(text) { | ||
return encodeURIComponent(text).replace(/%(23|2C|2F|3F|5C)/g, "%25$1"); | ||
return encodeURIComponent(text).replace(/%(23|2C|2F|3F|5C)/g, '%25$1'); | ||
} | ||
; | ||
/** | ||
@@ -40,11 +39,13 @@ * Generates a social sharing image with custom text using Cloudinary’s APIs. | ||
// configure the tagline text | ||
var taglineConfig = tagline ? [ | ||
"w_" + textAreaWidth, | ||
'c_fit', | ||
"co_rgb:" + textColor, | ||
'g_north_west', | ||
"x_" + textLeftOffset, | ||
"y_" + taglineTopOffset, | ||
"l_text:" + taglineFont + "_" + taglineFontSize + taglineExtraConfig + ":" + cleanText(tagline), | ||
].join(',') : undefined; | ||
var taglineConfig = tagline | ||
? [ | ||
"w_" + textAreaWidth, | ||
'c_fit', | ||
"co_rgb:" + textColor, | ||
'g_north_west', | ||
"x_" + textLeftOffset, | ||
"y_" + taglineTopOffset, | ||
"l_text:" + taglineFont + "_" + taglineFontSize + taglineExtraConfig + ":" + cleanText(tagline), | ||
].join(',') | ||
: undefined; | ||
// combine all the pieces required to generate a Cloudinary URL | ||
@@ -51,0 +52,0 @@ var urlParts = [ |
{ | ||
"name": "@jlengstorf/get-share-image", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "author": "Jason Lengstorf <jason@lengstorf.com> (https://lengstorf.com)", |
@@ -55,3 +55,3 @@ # Generate Social Media Images Using Cloudinary | ||
| title | true | (string) title text to be placed on the card | | ||
| tagline | true | (string) tagline text to be placed on the card | | ||
| tagline | | (string) tagline text to be placed on the card | | ||
| cloudName | true | (string) your Cloudinary cloud name (i.e. your username) | | ||
@@ -58,0 +58,0 @@ | imagePublicID | true | (string) the public ID of your social image template | |
10815
98