I am trying to make a website code with HTML, CSS, and JavaScript which will allow someone to upload an image and:
- crop the picture to fit a face within a circle (just like a profile picture)
- add text to the picture around the edge and
- print out the picture
So far I've been able to come up with this from one of Martin Zikmund's answers on how to add a profile picture which can take a picture and crop it into a circle (it's not centered though), and right now the printing step can be crudely accomplished by printing out the page, however I'm unsure of how I can add in the text around the edge and if I can allow the user to only print out said picture.
All that I've been able to put together so far again is attributed to this answer
$("#profileImage").click(function(e) {
$("#imageUpload").click();
});
function fasterPreview( uploader ) {
if ( uploader.files && uploader.files[0] ){
$('#profileImage').attr('src',
window.URL.createObjectURL(uploader.files[0]) );
}
}
$("#imageUpload").change(function(){
fasterPreview( this );
});
#imageUpload
{
display: none;
}
#profileImage
{
cursor: pointer;
}
#profile-container {
width: 1.125in;
height: 1.125in;
overflow: hidden;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
}
#profile-container img {
width: 150px;
height: 150px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="profile-container">
<image id="profileImage" src="https://lorempixel.com/100/100" />
</div>
<input id="imageUpload" type="file"
name="profile_photo" placeholder="Photo" required="" capture>