2
votes

as Gmail API instructed, I requested attachment from

GET https://www.googleapis.com/gmail/v1/users/userId/messages/messageId/attachments/id

and I received this:

stdClass Object
(
    [size] => 10842
    [data] => _9j_4AAQSkZJR......
)

Question: How do I convert [data] => _9j_4AAQS..... to a human readable image ?

in order to your test, the complete string is here below

_9j_4AAQSkZJRgABAQAAAQABAAD_2wCEAAkGBxITEhUTEhIWFhUXFxcXFxgYFx0VGxoYFRcXFhYXFxUaHSggGBolHxoYITEhJSorLi4uGB8zODMtNygtLisBCgoKDg0OGxAQGzYlICUvLS8rNy8tMC8tLy8rLy0tNTArKy8tLS0tLS8rLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf_AABEIAOEA4QMBIgACEQEDEQH_xAAbAAABBQEBAAAAAAAAAAAAAAAAAgMEBQYBB__EAEcQAAIBAgMFBgIHBgMGBgMAAAECEQADBBIhBTFBUWEGEyJxgZEyoSNCUmKCscEUcpKy0fAHouEVFjNDg8IkU2OT0vEXVXP_xAAbAQACAwEBAQAAAAAAAAAAAAAABAIDBQEGB__EADQRAAICAgECBAUDAwMFAQAAAAECAAMEESESMQUTQVEUIjJxoWGB8CORwUKx4RUzUtHxBv_aAAwDAQACEQMRAD8A9xoooohCiiiiEKKKKIQoork0QnaKSXptrld1OEgR2iajtdqKuPUuyA-JYnlr13E6elGpHq32liWrmaoRvUk3qn0SHmiTjdFJ76qHAuczXCTFwnSeKkqscvCPlUzvqjWA42JK5jW2jLQXaUGFVYv04t-pmuQF25YzQKo9p4xz9HaMOVLE78o4acyRHkDVrYvSATvIH5VSCCxUekY1pQx9ZIopKtSq7OQoooohCiiiiEKKKKIQoooohCiiiiEKKKKIQorhNNu9dAnCdRTNTTXKbe5ULHYgqhK_FuXzOgqWtDcr6ix0IsbRU3TaE5gpYnhoVBWeYzL70trlRP2QWlTidVJ_eBZiepYTSXu12jbjZkMkhG0IvGYghTl-I6L-8dB86T-yi1l6ggnmZDE-pk-tN27ozAngZ9RupN3Fl0QtGbUkDhO4GeMQPeh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r1t_PLPyivQcXgbV0Rdto45Mob86oMZ2A2dc34ZV6oSn5GqTh6-liJd8ZS31pK5O1FzebanqJFPDtXztf5v8ASo1z_CvB_wDLu4i3-7cB_mUmmT_hiB8OPxI88rfkBUfh7vR_xJeZiGTv96RM9zr-9_pXD2qPC1_m_wBKg_8A40f_APYXv4R_8qUv-GAPxY_EnyKr-hrnw9__AJ_iHXifzceudp7vBFHnJqsxfapx8V9E8sv-pqztf4W4L_mXMRc_euR_Koq2wXYTZ1vdhUJHFpf-Y134Rz9Tw-Ixl7LueeX-1COcqvcvN9lAXPtUzCbL2lf_AOFhRZU_WvtGnPKAT8q9Vw2Et2xFtFQclUKPYU9U1wqh35-8g3iB_wBC6mB2f_hura43EPfPFFm0n-Uz8xW12fs61YQJZtrbUcFECpVFNBQOAIlZfZZ9RnBXaKK7KoUUUUQhRRRRCFFFFEIUUUUQhRRRRCFFFFEIUUUUQhRRRRCcNFFFE4Zyu0UVz1gIUCiiuwhQKKKITtcFdoonYUUUUQhRRRRCFFFFEIUUUUQhRRRRCf_Z

Thank you.

1

1 Answers

1
votes

As written in Gmail API reference Property data is of type bytes. Its Description says:

The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.

To get the file, use following code:

$data = strtr($data, array('-' => '+', '_' => '/'));

$fh = fopen(DOC_ROOT."/file.pdf", "w+");
fwrite($fh, base64_decode($data->data));
fclose($fh);

Hope it helps!