Created
September 8, 2021 15:36
-
-
Save motyar/55ac970f4a240294149630ec2c866be6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var api = 'https://api.quotable.io/random'; | |
var template = 'https://img.bruzu.com/?backgroundColor=black&backgroundImage=https://source.unsplash.com/500x800?wallpaper&backgroundImage.opacity=0.5&height=800&a.fontSize=60&a.fontFamily=Poppins&a.fontWeight=800&a.width=400&a.color=white&b.originY=bottom&b.top=770&b.width=400&b.color=white&b.fontFamily=Lora&b.fontSize=30'; | |
var imgUrl = ''; | |
// Fetch the data from JSON API | |
fetch(api) | |
.then(response => response.json()) | |
.then(data => { | |
const params = new URLSearchParams({ | |
"a.t": data.content, | |
"b.t": data.author | |
}); | |
imgUrl = template + "&" + params.toString(); | |
console.log(imgUrl); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment