I'm not exactly sure how to word this so apologies if the title is misleading. I'm using UPS's web service to create a shipping label, this is returned as a GIF, but not as an image, instead as a long code:
R0lGODdheAUgA+cAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09....... (etc)
My question is how do I use this to get an actual GIF image? preferably to output to file, and using either JavaScript or PHP.
Thanks in advance!
The string looks like base64-encoded data. Assuming it is, in fact, an image then you can decode it like this:
Once you have the decoded data you can e.g. save it to a file:
Or you can output it to a browser as a GIF image: