This page looks best with JavaScript enabled

postman预览二进制图片

 ·  ☕ 1 min read  ·  🎅 [emacle] · 👀... views

使用 base64 编码二进制图片数据,置入 <img> 标签

1
2
3
4
5
6
7
8
9
<?php
try {
    // getDiagram 获得二进制流图片 可显示流程进度
    $diagramBinary = $serviceFactory->createProcessInstanceService()->getDiagram($processInstanceId);
    $base64 = 'data:image/png' . ';base64,' . base64_encode($diagramBinary); // base64加密二进制图片
    echo '<img src="' .  $base64 . '" />'; // binary image to base64 so postman can preview image
} catch (ActivitiException\ActivitiException $e) {
    var_dump($e->getMessage());
}

效果图:


emacle
WRITTEN BY
[emacle]
Emacser orgmode

 

What's on this Page