idcreatv's avatar

Storing Signature Pad Base64 using Image Intervention

Hi all, hope someone can help me with a problem I have with Signature Pad.

I've dd'd all of this and all is fine until it gets to the Image::make section where I'm getting an internal server error 500.

I've used intervention to upload images and store them without any issues but converting into a PNG file is proving a problem and I'm not sure where I'm going wrong.

This is my code:

$data = $request->customer_signature;
$filename = $quote->approval_id.time().".png";
$path = public_path('images/customer-signatures/' . $filename);
Image::make(file_get_contents($data))->save($path);

The $data variable contains the PNG code from Signature Pad in the following format:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA… etc

Dd'ing it, I see the correct code as above.

The $filename is generated from another variable - again, dd'ing it shows the correct name.

The $path is writable and dd's fine.

Does anyone have an idea where I'm going wrong? Any advice would be most appreciated!

0 likes
1 reply
idcreatv's avatar
idcreatv
OP
Best Answer
Level 3

Looks like I had an issue with Mamp - restarted it and all okay. Weird.

Can a mod delete this thread please?

Ta!

Please or to participate in this conversation.