3

PHP を使用して SOAP サービスからデータを取得しています。その一部は base64 でエンコードされた画像のバイト配列であり、その画像をブラウザーに表示したいと考えています。データの取得手順は正常に機能しますが、この画像をブラウザーに表示する方法が 1 つも見つかりません。
バイト配列が $byteArray として PHP に格納されていると仮定します。

$img = "<img src= 'data:image/jpeg;base64, $byteArray' />";
print($img);

そのコードがブラウザに画像を表示することを期待していますが、ブラウザのパーサーは失敗し続けています。私が間違っていることは何か分かりますか?

ここで使用した byteArray の例は、"[B@14a3da8" です。

前もって感謝します、ブライアン

4

3 に答える 3

6

このコードを実行すると:

$imgData = "/9j/4AAQSkZJRgABAQEBLAEsAAD/7gAOQWRvYmUAZAAAAAAA/+0TrFBob3Rvc2hvcCAzLjAAOEJJ
TQQEAAAAAAAHHAIAAAIAAAA4QklNBCUAAAAAABDo8VzzL8EYoaJ7Z63FZNW6OEJJTQQvAAAAAABK
uB8BAEgAAABIAAAAAAAAAAAAAAAAAwAATAIAAPT////0////DAMAAFgCAAAAAQAFAAD8AwAAAQAP
JwEAcABzAGQAAAAuAHAAcwA4QklNA+0AAAAAABABLAAAAAEAAQEsAAAAAQABOEJJTQQmAAAAAAAO
AAAAAAAAAAAAAD+AAAA4QklNBA0AAAAAAAQAAAAeOEJJTQQZAAAAAAAEAAAAHjhCSU0D8wAAAAAA
CQAAAAAAAAAAAQA4QklNBAoAAAAAAAEAADhCSU0nEAAAAAAACgABAAAAAAAAAAI4QklNA/UAAAAA
AEgAL2ZmAAEAbGZmAAYAAAAAAAEAL2ZmAAEAoZmaAAYAAAAAAAEAMgAAAAEAWgAAAAYAAAAAAAEA
NQAAAAEALQAAAAYAAAAAAAE4QklNA/gAAAAAAHAAAP////////////////////////////8D6AAA
AAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAAA
AP////////////////////////////8D6AAAOEJJTQQAAAAAAAACAAA4QklNBAIAAAAAAAoAAAAA
AAAAAQABOEJJTQQwAAAAAAAFAQEBAQEAOEJJTQQtAAAAAAAGAAEAAAADOEJ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DQjM2M0NCRjI0
OTkzMjJEMzkwQzE5Ij4gPHhhcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InV1aWQ6
MDRFOEU3N0EwMjUwRTExMTg0RDJEM0E3NTRDODU3RjQiIHN0UmVmOmRvY3VtZW50SUQ9InV1aWQ6
NzQ1NEUxNEIwMEM3REQxMUI0NUVCMzIxRjEwNjMyQkIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwv
cmRmOlJERj4gPC94OnhtcG1ldGE+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgPD94cGFja2V0IGVuZD0idyI/Pv/bAEMAAgEBAgEBAgICAgICAgID
BQMDAwMDBgQEAwUHBgcHBwYHBwgJCwkICAoIBwcKDQoKCwwMDAwHCQ4PDQwOCwwMDP/AABQIAAkA
KARDEQBNEQBZEQBLEQD/xAAbAAADAAIDAAAAAAAAAAAAAAAGBwgBBAAFCf/EADgQAAEDAwMBBAYJ
BAMAAAAAAAIBAwQFBhEABxIIISI0chMxMjdhcRQXM0J0grGysxZBUXW0wdH/2gAOBEMATQBZAEsA
AD8A8ydrbYZDa224cSiUiCzIp7rj8mY5j6U6URp5HFAkVCRSEkTvCuFFUwi6mrpy26p8XYexqZTb
Ttmkw5lIkOzJ9RfUSnvHT48kX1aNCFxDMTRFU21UVBRRBXGinpG2ms6FtHaMCHbFuU6nyae46/Lk
milNcOIy8jytkiiXIkLC8hXHFUwi40VdI201nQdo7RgQ7Yt2nQJNPcdflyTRSmuHEZeR5WzRRLkS
FheQrjiqYRcaVgdFt27pyplwUB+zDpFTqUgYgnctNhucUlGzlWFdRWw5Cq+rigJyTuYXSMPoZrO6
1xVW4aA5Yr1EqtZmDDT+pqZDLikxxnP0f0qejBCFVTCcEBOQ5DC6am1PSLtjes2RU3Tt0oU6a/6E
RqMRniiPEHY0hJxTKKqYTjx7U7uF0wNuOnHaW4qzMmyioxRZM19W0bkx2xREdJO62KoiJlFxx7uP
V2YXTW222EiBtRQwrm2W2NxFDiA03Umtx4FPlSnXpDi83wFzkaojzIoK9oCwa57V40Js9svt7G2P
tuJdWyO093vUqALDdYj7mwqZNqD78p4lckg25lxUR+MAiXa2MY+9hVQaLofTL02lt7ACXS7UqLkV
rgL309hpx8jNVy4QuIpKnIU73qQPnqiKNs10vjYcGPNpFDqD0NpQR5HAaN8iMly4QGil7QomfUg/
PXaO9I9B+r+pUqRt9YFNq7dukMStJulAmGU30jTQyHBSQLYplSMgESzyTAoKLjlc6VNq/qarlAPZ
zbyj3OzaBs025freh1B06r6RlkJjwJIBkBypmQA2eeaYBBRcK/dvpb2JGy6pAg21Z7FSWlEESorc
7JkEjkAC+Y+l4JhVVVFBLOU7MIulbuvsr09nZNTgU+17eZqRUsmolQWtoZjJyIi+YK4gIidqqiCu
cp2Y0h9yOhS89rbJmXBVp9iJT4YKapEu2nzHzVMdwWmnSNS7fVj/ADqOt6egK7tpLFnXJV5m3aUq
EBGaRLyp02SePuAwy4ThH8MJnXn71X9E9Nsi2p9ZkOWKlJiCRmoXBEdklj7oNNmpEXwVE1APU/0q
0K2qLNqZlaKU2OhEapV45vl8BbAlJS+ComtTaj3a1P8ACyP4T1jpt9xFd/10z/iu6RPRv7nZ/wCC
k/wOaT3Rz7nqh+Ck/wADmlEvr1OU/wC2LyB+0dENpeETyD+1NE9leAHyD+1NZc9rW/J8YflX9NGj
XhfyaNWPA/l1xPaT5a0F9sfN/wBLoIub7F7zL+i6Cbq8O/8AP/3WB/v8tdTH8cvlXU17s+Nc8q6m
neDxTvyXX//Z";
echo "<img src='data:image/jpeg;base64, $imgData' />";

(申し訳ありませんが、これは 40x30 ピクセルの画像ですが、とにかく巨大です)。

画像が表示されます。

あなたの構文は大丈夫だと言っているすべてのこと:

echo "<img src='data:image/jpeg;base64, $imgData' />";

$imgData に実際の画像が含まれている場合、画像を出力します。

于 2012-09-21T20:51:58.157 に答える
1

データをbase64でエンコードする必要があります。これは必須であり、文字セット変換がデータに触れないようにします。

正しいコードは

$imgData = base64_encode($byteArray);
$img = "<img src= 'data:image/jpeg;base64, $imgData' />";
print($img);
于 2012-09-21T20:40:46.803 に答える