dopr25398 2015-06-14 14:57
浏览 1069

在https中显示http图像的麻烦

I need to embed http image in my https website, because if simply use <img src="http://www.sof.com/abc.jpg"/> will not show in https website.

After that, I was search some topic of this function, I found that something like <img src="https://www.some.com/image.php?url=http://www.sof.com/abc.jpg" /> can be show in https

So now I was genarate 2 source. 1 is the image file: http://www.website1.com/abc.png,

and the https web adress is https://fb.ccc.com

after that I create the image.php code was below:

<?  
        $strFile = base64_decode(@$_GET['url']);
        $strFileExt = end(explode('.' , $strFile));
        if($strFileExt == 'jpg' or $strFileExt == 'jpeg'){
            header('Content-Type: image/jpeg');
        }elseif($strFileExt == 'png'){
            header('Content-Type: image/png');
        }elseif($strFileExt == 'gif'){
            header('Content-Type: image/gif');
        }else{
            die('not supported');
        }
        if($strFile != ''){
            $cache_expire = 60*60*24*365;
            header("Pragma: public");
            header("Cache-Control: maxage=". $cache_expire);
            header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $cache_expire).' GMT');



        }
        exit;
?>

if I request the link: https://fb.ccc.com/image.php?url=http://www.website1.com/abc.png , then the page will be respone not supported

I was also try $strFile = $_GET['url']; but it only show blank. if I try $strFile = var_dump(@$_GET['url']); and the page will respone string(31) "http://www.website1.com/abc.png" not supported

so someone can help to find out what is my script problem?

thank you very much!

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!