问题描述
我已经设置了一个系统来显示来自 Active Directory 的每个人的姓名、电子邮件地址和电话号码,但是我无法让thumbailPhoto"工作.
I've set up a system to display everyone's name, email address and phone number from Active Directory however I can't get the 'thumbailPhoto' to work.
我在互联网上四处搜索,但无法找到这是否可行,或者至少找不到从 Active Directory 返回的格式.
I have searched around on the internet but haven't been able to find if this is possible or at the very least what format is returned from Active Directory.
我目前正在使用 adldap 类,所以如果可以使用它,那将是理想的.
I am currently using the adldap class so if it is possible to use this that would be ideal.
提前致谢.
我可以在 thumbnailPhoto 属性中检索数据,如果我将它们直接转储到浏览器,我会得到如下信息:
I can retrieve the data in the thumbnailPhoto attribute and if I dump them straight to the browser I get something like this:
àJFIFáPExifII*bh~(2iXCanonCanon EOS 5D MarkIII2013:05:19 17:35:31àè"' 0230’' ' ('0'8' ' '@''11''11 0100HP¤¤¤¤ 2013:04:1711:44:522013:04:17 11:44:52Ho@BèdnW~:(’HHàJFIFC $.",#(7),01444'9=82<.342C2!!22222222222222222222222222222222222222222222222222–d"}!1AQa"q2'#B±R$3br,%&'()456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz…‰'"–~¤§¨·×áèéêòó÷ùùúw!1AQaq"2B'± #3Rbr $4á%&'()
àJFIFá PExifII*bh~(2iXCanonCanon EOS 5D Mark III2013:05:19 17:35:31àè"' 0230’ ’ ’ (’0’8’ ’ ’@‘’11’’11 0100 HP¤¤¤¤ 2013:04:17 11:44:522013:04:17 11:44:52Ho@B èdnW:(’ HHàJFIFC $.' ",#(7),01444'9=82<.342C 2!!22222222222222222222222222222222222222222222222222–d" }!1AQa"q2‘#B±R$3br %&'()456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz…‰’""–—¤§¨·×áèéêòó÷ùú w!1AQaq"2B‘± #3Rbr $4á%&'()
这还不是全部,但它是一个很长的字符串,我假设是某种二进制字符串?
That isn't all of it but it is a very long string, I am presuming is some sort of binary string?
推荐答案
这似乎是一个 JPEG 文件,因此您应该能够将该数据与适当的 mime 类型一起发送到浏览器.应该可以使用以下内容输出该图像:
This seems to be a JPEG-File, so you should be able to send that data together with the appropriate mime-type to the browser. It should be possible to output that image with something like:
<img src="data:image/jpeg;base64,<?php echo base64_encode($imageString); ?>"/>
但也可以将 any 图像格式的文件保存到该 thumbnailPhoto 属性中.因此,我会将内容放入一个临时文件中,然后直接从服务器提供该文件.您需要通过 finfo 传递文件以获得正确的 mime-type.
But it might also be possible to save files of any image format into that thumbnailPhoto attribute. Therefore, I would put the content into a temporary file that will then be served directly from the server. You will need to pass the file through finfo to get the correct mime-type.
所以你可以这样做:
$tempFile = tempnam(sys_get_temp_dir(), 'image');
file_put_contents($tempFile, $imageString);
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mime = explode(';', $finfo->file($tempFile));
echo '<img src="data:' . $mime[0] . ';base64,' . base64_encode($imageString) . '"/>';
这篇关于在 PHP 中显示来自 Active Directory 的缩略图照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)