ColdSharper
ColdSharper

Reputation: 84

How do I parse a json image returned from an API?

To make an example Wordpress plugin that shows an image, or at least stores it in the media library, I go out to the NASA Open API and fetch the Astronomy Picture of the Day. I have not yet tested that code, but assuming it works my problem is: then what? I guess I have to parse the return data and somehow get an image file I can upload to the library. I'm used to grabbing pre-known text fields such as data.customerid, etc. but never an image. The API site is not much help. I have gleaned from around here a few references to "base64" but I don't know what that means. I can't find a straightup example if what to do. Any thoughts?

Upvotes: 0

Views: 77

Answers (1)

Kresimir Pendic
Kresimir Pendic

Reputation: 3614

you'll have to do steps along this lines, you are pretty much correct on that:

I suggest you to start building your plugin from scratch and then when you get stuck post your code here and community can help you better..

Upvotes: 1

Related Questions