Source Code:
(back to article)
<?php // Base64-encoded image data $img_string = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQTEhQUExMWFhUXGBcaGRgYGBcaGBgZGhgfGxoaHSggGB0lHRgaITEhJSkrLi4uGB8zODMtNygtLisBCgoKDg0OGxAQGy0lICYtLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIAKgBLAMBIgACEQEDEQH...'; // Decode the base64 string and save as a file $img = base64_decode($img_string); file_put_contents('image.jpg', $img); // Check if the image was saved if (file_exists('image.jpg')) { echo "Image saved successfully."; } else { echo "Failed to save image."; }
Result:
Report an issue