files
directory has 755
(or 777
) permission. Image Picker has two sets of options: the jQuery plugin options (see Options section) and the PHP class options (see Configuration section). The included examples have some options set, but you can change them however you want.
This is how the jQuery plugin options look like:
$('#avatarModal').imgPicker({
url: 'server/upload_avatar.php',
aspectRatio: 1,
cropSuccess: function(image) {
$('#avatar').attr('src', image.versions.avatar.url);
this.modal('hide');
}
});
This is how the PHP class options look like:
$options = array(
'upload_dir' => __DIR__ . '/../files/',
'upload_url' => 'files/',
'accept_file_types' => 'png|jpg|jpeg|gif',
'versions' => array(
'avatar' => array(
'crop' => true,
'max_width' => 200,
'max_height' => 200
)
)
);
new ImgPicker($options);
Image Picker requires PHP 5.3+ with GD.
Image Picker works on all major browsers (including mobile) with some exceptions:
Starting with version 47, Chrome requires a secure connection (SSL) in order to use the Webcam. Read more here.
In Safari 5, IE8 and IE9 only the upload works due to no XHR support.