Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Remove the metadata from the base64 to get a correct png file
Browse files Browse the repository at this point in the history
  • Loading branch information
petermorlion committed Aug 25, 2023
1 parent 2e03c99 commit 8c5979c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mxp-sepaqr/muxp-sepaqr.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,10 @@ function muxp_set_persistent($id, $qrcode) {
mkdir($target_dir);
}

file_put_contents($target_dir . "/$id.png", base64_decode($qrcode));
// Remove the 'data:image/png;base64,' part
$qrcode_stripped = explode(',', $qrcode)[1];

file_put_contents($target_dir . "/$id.png", base64_decode($qrcode_stripped));

return wp_upload_dir()['baseurl'] . "/muxp-sepa-qr-code-addon-for-woocommerce/$id.png";
}
Expand Down

0 comments on commit 8c5979c

Please sign in to comment.