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

在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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
    • ¥20 matlab yalmip kkt 双层优化问题
    • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多
    • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
    • ¥15 有赏,i卡绘世画不出