PHP图像没有使用img元素在HTML中显示

0 html php

你好,我有一个包含的PHP文件:

当我访问PHP文件时图像显示正确,但是当我尝试在HTML模板中显示它时,它显示为带有裂缝的小img,所以基本上说"图像未找到"

<img src="http://konvictgaming.com/status.php?channel=blindsniper47">
Run Code Online (Sandbox Code Playgroud)

是我用来在HTML模板中显示它,但它似乎并不想显示,我已经尝试搜索我的具体问题没有结果,虽然我确定我可能搜索错误的标题

从下面的OP添加代码

$clientId = '';             // Register your application and get a client ID at http://www.twitch.tv/settings?section=applications
$online = 'online.png';     // Set online image here
$offline = 'offline.png';   // Set offline image here
$json_array = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams/'.strtolower($channelName).'?client_id='.$clientId), true);

if ($json_array['stream'] != NULL) {
    $channelTitle = $json_array['stream']['channel']['display_name'];
    $streamTitle = $json_array['stream']['channel']['status'];
    $currentGame = $json_array['stream']['channel']['game'];

    echo "<img src='$online' />";
} else {
    echo "<img src='$offline' />";
}
Run Code Online (Sandbox Code Playgroud)

Joo*_*ost 6

网址不是图片,是具有以下内容的网页

<img src='offline.png' alt='Offline' />
Run Code Online (Sandbox Code Playgroud)

网页无法显示为图像.您需要编辑页面以仅使用正确的http-header传输实际图像.

你可以通过谷歌搜索"php动态图像"找到一些帮助.