Skip to content

Instantly share code, notes, and snippets.

@motyar
Last active September 8, 2021 15:48
Show Gist options
  • Save motyar/e726193a553bb7eca306d055fe47369b to your computer and use it in GitHub Desktop.
Save motyar/e726193a553bb7eca306d055fe47369b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script>
(function(){
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();
window.location.href = imgUrl;
});
})();
</script>
</head>
<body>Generating image.. We will redirect you to the output image..</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment