问题
I am using ue UPS shipment API ...
<LabelSpecification>
<LabelStockSize>
<Height>4</Height>
<Width>6</Width>
</LabelStockSize>
<LabelPrintMethod>
<Code>EPL</Code>
<Description>epl file</Description>
</LabelPrintMethod>
<HTTPUserAgent>Mozilla/4.5</HTTPUserAgent>
<LabelImageFormat>
<Code>GIF</Code>
<Description>gif</Description>
</LabelImageFormat>
</LabelSpecification>
. . .
it's return raw format of image like STgsQSwwMDEKSTgsQSwwMDEKT0QKcTc5NQpRMTYwMCwyNApTMgpEMTAKSkYKTgpaVApiMTMsNDI5LE0sIjAxNSw4NDAsMTk0MDYsMDAwMCxbKT4eMDEdOTYxWjk0NjM4NzYzHVVQU04dNDRBQTE1HjA3L1RNRjItODIlKVFNKE1VQloyMDcpWEoyK0JORUlZOEorXCJcDVEgLBxZJDhEXA1cDR4EIgpBMTcsNywwLDIsMSwxLE4sIlRFU1QiCkExNywyNCwwLDIsMSwxLE4sIjExMS0xMTEtMTExMSIKQTE3LDQxLDAsMiwxLDEsTiwiMTE1MCBGSVJTVCBBVkUiCkExNyw1OCwwLDIsMSwxLE4sIktJTkcgT0YgUFJVU1NJQSAgUEEgMTk0MDYiCkE2MiwxNjQAAAAP/////....
I want to know how can I save the image to my pc and to show it on the web page.
回答1:
I succeed in php, using fopen and fwrite to create a gif file,such as
$file=fopen("temp.gif","w");
fwrite($file,base64_decode("the encoded string..."));
this will get a gif file,then you can put it on the web.Remenber to chown the folder where you save the gif file with apache:apache.
回答2:
Not familiar with UPS API but USPS returns label data base64 encoded. Maybe try and use the function base64_decode and then file_put_contents to save to disk.
来源:https://stackoverflow.com/questions/11535698/ups-epl-label-show-on-web-page