I used perl LWP module to fetch an image from a URL.
CGI FILE(say img.cgi)
my $ua = LWP::UserAgent->new( timeout => $timeout );
my $respons = $ua->request(POST $url, Authorization => $auth_header);
if ($respons->is_success) {
$ImgContent = $respons->decoded_content;
}
print $ImgContent;
Then I am calling above CGI as an http request, using cold fusion:
img_display.cfm file
<cf_http method="POST" url="img.cgi" timeout="60" throwonerror="no" local="yes">
....
</cf_http>
<cfoutput>
#cfhttp.filecontent#
</cfoutput>
Whenever I hit the URL ......./img_display.cfm, from internet explorer browser, the browser displays the image perfectly.
However whenever I hit the same URL from Chrome or FireFox, instead of image, browser display, some weird characters(equivalent to the image opened in note pad).
ÿØÿàJFIFSÿþ4Created using the Colosseum Builders JPEG libraryÿÀ&ŠÿÛ„ " " ÿÄ{ !"t³Ô#1468UWv–²´Ó27AQVu”•$5BXfs“¦Ñ%3DRTb‘±aµ&qr†—¡Ò CGw‚„ÃÿÚ?úF4cM®ž¦Ý=sÓÜJléXÕ½é±F'p£6¤dJ‘*ªªª÷ªoÁ:Yói†}^‹øtö ÒÏ›L3êô_ç°N–|ÚaŸW¢þ=‚t³æÓú½ðé쥟6˜gÕ过O`,ù´Ã>¯Eü:{égͦõz/áÓØ'K>m0Ï«ÑžÁ:Yói†}^‹øtö
I have no idea, why IE displays image while chrome and Firefox displays image code.
Any help is appreciated.