Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some resulting images are black #557

Open
robico opened this issue Aug 2, 2018 · 1 comment
Open

Some resulting images are black #557

robico opened this issue Aug 2, 2018 · 1 comment

Comments

@robico
Copy link

robico commented Aug 2, 2018

Have being using croppie 2.6.2 in a website I have built for a client who has a few hundred clients who can upload profile pics and a handful of people have reported that they have been having trouble with resulting images. So I've downloaded the images from the server and some of those images are just black.

There is no common browser this is occurring on as some have tried on safari version 7.1.6 (9537.85.15.3), chrome Version 67.0.3396.87 and firefox.

Here is the JS that sends the info to the server:

jQuery('.upload-profile-image').on('click', function (ev) {
	var id = jQuery("#id").val();
	$uploadCropProfile.croppie('result', {
		type: 'canvas',
		size: {width: 1500, height: 655}
	}).then(function (resp) {
	        jQuery.ajax({
			url: "/advertiser/actions/visualeditorajax.php",
			type: "POST",
			data: {"image":resp, "request":"uploadnewprofileimage", "id":id},
			success: function (returned) {
				var msg = jQuery.parseJSON(returned);
				console.log(msg);
				if(msg.status == "success"){
					jQuery(".profile-img-container").html(msg.image);
				}
				jQuery(".croppie-profile-image").hide();
				jQuery('html, body').animate({
					scrollTop: 0
				}, 1000);
			}
		});
	});
});

Then the PHP that handles the save (edited for only the relevant lines) :

$data = $_POST['image'];
list($type, $data) = explode(';', $data);
list(, $data)      = explode(',', $data);
$data = base64_decode($data);
$imageName = "image_".time().'.jpg';
$newfilename = $this->update_file_name($imageName, $uploaddir);
file_put_contents($uploaddir.$newfilename, $data);

Any help will be greatly appreciated!

@bgillet
Copy link

bgillet commented Oct 9, 2020

I confirm I have the same issue. Everything is working fine most of the time but sometimes, the image is either totally black or has a big black strip at the bottom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants