简体   繁体   English

使用html_entity_decode显示图像

[英]display image using html_entity_decode

Currently I am trying to use html_entity_decode to display 2 images on the same page. 目前我正在尝试使用html_entity_decode在同一页面上显示2个图像。

   $ent  = file_get_contents('./olympic.jpg');
   $ent1 = file_get_contents('./olympic1.jpg');
   $s  =  htmlspecialchars($ent1,ENT_COMPAT,'iso-8859-1');
   $s1 =  htmlspecialchars($ent,ENT_COMPAT,'iso-8859-1');

   $s2 = html_entity_decode($s, ENT_COMPAT,'iso-8859-1');
   $s3 = html_entity_decode($s1, ENT_COMPAT,'iso-8859-1');

   Header("Content-Type: image/jpeg");
   echo ($s2);
   echo ($s3);

I am now able to display $s2 but unable to display $s3. 我现在能够显示$ s2但无法显示$ s3。 This is just a testing page, in the real system the image will be sent over from webservices in iso-8859-1 encoding. 这只是一个测试页面,在真实系统中,图像将以iso-8859-1编码从webservices发送。 Any help would be appreciated. 任何帮助,将不胜感激。

This has nothing to do with html_entity_decode(). 这与html_entity_decode()无关。 You can't display two images in a single HTTP response. 您无法在单个HTTP响应中显示两个图像。 You have to serve an HTML document (Content-Type: text/html) that contains two embedded images. 您必须提供包含两个嵌入图像的HTML文档(Content-Type:text / html)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM