Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $fileExtension = '.jpg';
- $replaceMime = 'data:image/jpeg;base64,';
- if (strpos($image['src'], 'data:image/png;') !== false) {
- $fileExtension = ".png";
- $replaceMime = 'data:image/png;base64,';
- }
- // base64 decode and save to file
- $base64Image = str_replace($replaceMime, "", $image['src']);
- file_put_contents($imageLocation, base64_decode($base64Image));
Add Comment
Please, Sign In to add comment