Skip to content

Instantly share code, notes, and snippets.

@motyar
Created September 8, 2021 15:36
Show Gist options
  • Save motyar/55ac970f4a240294149630ec2c866be6 to your computer and use it in GitHub Desktop.
Save motyar/55ac970f4a240294149630ec2c866be6 to your computer and use it in GitHub Desktop.
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