Import the profile-picture.js
and profile-picture.css
to your project, then use the html
template from the index.html
file.
var pp = profilePicture(cssSelector, imageUrl?, options?);
{
imageSrc,
width,
height,
originalWidth,
originalHeight,
top,
left,
scale,
cropWidth,
cropHeight
}
slider: {}
Slider's handler initial position
When the slider's handles is on its minimum position
When the slider's handles is on its maximum position
image: {}
Set the minimum image's width size acceptable
Set the minimum image's height size acceptable
Define the original image's width
Define the original image's height
Define the original image's left offset
Define the original image's top offset
Enable/Disable the image helper
Set the image helper overlay
When the image is loaded, this callback is called with the model as parameter.
When anything changed, this callback is called with the model as parameter.
When the image is remove, this callback is called with an empty model as parameter.
When you drag the slider handler/zooming, this callback is called with the model as parameter.
When you drag the image, this callback is called with the model as parameter.
When the image size change this callback is called with the model as parameter.
When something wrong happens, this callback is called with the error type as parameter.
Error type | Description |
---|---|
image-size | The image is too small |
file-type | The file isn't a image |
unknown | Errors didn't mapped |
Public method to return the model.
pp.getData();
Public method to return the base64 image format. @param quality 0.1-1. Default: 1
pp.getAsDataURL(quality);
Public method to remove the image.
pp.removeImage();
jQuery and FontAwesome*
*You can use other icon gallery as well.
- In older versions of Microsoft Edge the "drop files" feature doesn't work as expected. Bug link
IE10+ | Chrome | Firefox | Safari