Not working on iOS and Safari
See original GitHub issueIts working fine on Android, Chrome, Mozilla. But not working on iOS and Safari. If I uploaded an image from iOS then it’s getting 90* rotate. Also, the image is not uploading on Safari. This is my full code,
index.html
<html lang="en">
<head>
<title>PHP - jquery ajax crop image before upload using croppie plugins</title>
<script src="http://demo.itsolutionstuff.com/plugin/jquery.js"></script>
<script src="http://demo.itsolutionstuff.com/plugin/croppie.js"></script>
<script src="./exif.js"></script>
<link rel="stylesheet" href="http://demo.itsolutionstuff.com/plugin/bootstrap-3.min.css">
<link rel="stylesheet" href="http://demo.itsolutionstuff.com/plugin/croppie.css">
</head>
<body>
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">Image Upluad</div>
<div class="panel-body">
<div class="row">
<div class="col-md-4 text-center">
<div id="upload-demo" style="width:350px"></div>
</div>
<div class="col-md-4" style="padding-top:30px;">
<strong>Select Image:</strong>
<br/>
<input type="file" id="upload">
<br/>
<button class="btn btn-success upload-result">Upload Image</button>
</div>
<div class="col-md-4" style="">
<div id="upload-demo-i" style="background:#e1e1e1;width:300px;padding:30px;height:300px;margin-top:30px"></div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$uploadCrop = $('#upload-demo').croppie({
enableExif: true,
viewport: {
width: 200,
height: 200,
type: 'circle'
},
boundary: {
width: 300,
height: 300
}
});
$('#upload').on('change', function () {
var reader = new FileReader();
reader.onload = function (e) {
$uploadCrop.croppie('bind', {
url: e.target.result
}).then(function(){
console.log('jQuery bind complete');
});
}
reader.readAsDataURL(this.files[0]);
});
$('.upload-result').on('click', function (ev) {
$uploadCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
$.ajax({
url: "/ajaxpro.php",
type: "POST",
data: {"image":resp},
success: function (data) {
html = '<img src="' + resp + '" />';
$("#upload-demo-i").html(html);
}
});
});
});
</script>
</body>
</html>
ajaxpro.php
$data = $_POST['image']; list($type, $data) = explode(';', $data); list(, $data) = explode(',', $data); $data = base64_decode($data); $imageName = time().'.png'; file_put_contents('upload/'.$imageName, $data); echo 'done';
Please help me to fix.
Demo Link
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
If Safari isn't loading websites or quits on your iPhone, iPad, or ...
If Safari isn't loading websites or quits on your iPhone, iPad, or iPod touch · Connect to a different network · Restart your...
Read more >8 Ways to Fix Safari Not Working on an iPhone - MakeUseOf
1. Turn Off Safari Suggestions · 2. Turn On Cellular Data for Safari · 3. Edit Your Screen Time Settings · 4. Clear...
Read more >Safari Not Working On iPhone? Here's The Fix.
What's Really Causing The Problem? · Close And Reopen Safari · Clear Safari History And Website Data · Restart Your iPhone · Update...
Read more >Top 12 Ways to Fix Safari Not Working on iPhone and iPad
How to Fix Safari Not Working on iPhone and iPad · 1. Restart iPhone or iPad · 2. Turn off Safari Suggestions ·...
Read more >Safari Not Working on Your iPhone? Here's How to Fix It
Reset your wireless router. Turn mobile data off and turn it back on again. Clear Safari cache and data. Restart your iPhone.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
All of the demo code is in this repository.
https://github.com/Foliotek/Croppie/blob/master/index.html https://github.com/Foliotek/Croppie/blob/master/demo/demo.js
Pay close attention to this line: https://github.com/Foliotek/Croppie/blob/master/index.html#L530
The html you posted above does not reference exif.js.
Your
#upload
is a file input. A croppie element can’t be a file input. Make a separate div#croppie-el
and do$('#croppie-el').croppie(....)
If you have any further problems, I would recommend posting on stack overflow. They have a more active community and you’ll probably get help quicker. Croppie’s github is more for reporting bugs in the plugin’s behavior. If we have several questions in here to sort through, then the bugs don’t always get as much attention as they should.