Upload image base_64 format issue

Posted 1 week ago by atfinho

I'm trying to upload an image using Intervention Image package but I'm always getting the following error

** Intervention\Image\Exception\NotReadableException: Unable to init from given binary data. **

This is my upload code

this is the image string : data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD…d2dFZfOcMOByDWtESycgDHHSsa0xtCgcetagiWRQefSrMWf/Z"

           $image = $request->get('image');
           $name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];
        return response()->json(['status'=>200,'img'=>$request->get('image')]);

Any help ?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.