Search code examples
phplaravelcrop

laravel cropper issue not show full size image?


i am new in laravel. here i'm use ajax for getting selected image.i'm attach image for clarification. my image not show full size :-

public function saveCropImage(User $user) {
    if (!File::exists(public_path() . "/storage/thumbnail/userProfiles")) {
        File::makeDirectory(public_path() . "/storage/thumbnail/userProfiles", 0777, true);
    }

    $image_name = uniqid();

    $crop_destination = public_path('/storage/thumbnail/userProfiles/');

    $image_parts = explode(";base64,", request()->image);
    $image_type_aux = explode("image/", $image_parts[0]);

    $image_type = $image_type_aux[1];

    $image_base64 = base64_decode($image_parts[1]);

    $imageFullPath = $crop_destination . $image_name;

    file_put_contents($imageFullPath, $image_base64);

    return response()->json(['success' => 'Crop Image Uploaded Successfully', 'id' => $image_name]);
}

Problem enter image description here How to solve it ?


Solution

  • Try To Change viewMode: 2, on Cropper Script