Skip to content

Instantly share code, notes, and snippets.

@palumbo
Created January 31, 2016 04:14
Show Gist options
  • Save palumbo/93cde064d65c27bbb4c6 to your computer and use it in GitHub Desktop.
Save palumbo/93cde064d65c27bbb4c6 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Baconator (Powered by Filestack)</title>
<style>
body { font-family: sans-serif; }
#baconator {
background-color: #f44336;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
#uploadPhoto{
background-color: #4CAF50;
color: white;
border: none;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 0px 5px 0px 0px;
}
</style>
</head>
<body>
<h1>The Baconator (Powered by Filestack)</h1>
<button id="uploadPhoto">Upload a photo</button><button id="baconator" onclick="makeBacon();">DEPLOY BACON!!!!</button>
<br><hr>
<div id="container">
<img id="original" src="" />
</div>
<script type="text/javascript" src="https://api.filestackapi.com/filestack.js"></script>
<script>
filepicker.setKey("A1AJmUYdDTj2Y5wEFtRO7z");
// setting global variables
var url = '';
var img = document.getElementById('original');
document.getElementById('uploadPhoto').onclick = function(){
img.src = "";
filepicker.pick(
{
mimetype: 'image/*',
services: ['COMPUTER', 'FLICKR', 'IMAGE_SEARCH', 'WEBCAM', 'FACEBOOK' ],
imageMax: [1500, 1500],
cropRatio: 1/1
},
function(Blob){
url = Blob.url;
img.src = "https://process.filestackapi.com/A1AJmUYdDTj2Y5wEFtRO7z/resize=w:1500,h:1500/" + url;
}
);
};
function makeBacon(){
img.src = "https://process.filestackapi.com/A1AJmUYdDTj2Y5wEFtRO7z/resize=w:1500,h:1500/watermark=file:JGH7ZOcQnqiPZSxTC1xr,size:150/" + url;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment