I am making a GET request to a REST API using PHP to call an image. In the response body, I get something like this:
ÿØÿàJFIF
`ÿÛC $.' ",#(7),01444'9=82<.342ÿÛCòÛæ•‡P`:ëÇjË–ÖO$¬#39 ûÌp¿©ìö61iö6öP(X
2!!22222222222222222222222222222222222222222222222222ÿÀ0$"ÿÄ
ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ
ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ
$4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÚ?óä·ï7ç]W„üÚè{«©äŽÁ
cP=†3ýhŸºð…ql”Ž œ–X§bÃë¸^g«h·Z>§-Ë’ê7#®@‘FÈŽÄWºm®KÇÖmÕ_žÒeŽJ9GæTþäæÙó÷›ó¢¶Í¯=(
û+d]FÄÈ>QwþŒ\W¦¨® æÊG¶o#eÃÄOMêw/êw·)umÄrT¿B3@¬_ “×Ê{
What should I do with this to make it a viewable image?
Send the appropriate image
header. Check the Content-Type header to see what format it is. In case this is not the image binary but compressed content, run it throughgzuncompressfirst.