HTML5 Canvas getImageData and Same Origin Policy

后端 未结 9 1406
夕颜
夕颜 2020-11-29 07:49

I have a site running at pixie.strd6.com and images hosted through Amazon S3 with a CNAME for images.pixie.strd6.com.

I would like to be able to draw these images to

9条回答
  •  广开言路
    2020-11-29 08:20

    If you are using PHP, you can do something like:

        function fileExists($path){
            return (@fopen($path,"r")==true);
        }
        $ext = explode('.','https://cgdev-originals.s3.amazonaws.com/fp9emn.jpg');
        if(fileExists('https://cgdev-originals.s3.amazonaws.com/fp9emn.jpg')){
            $contents = file_get_contents('https://cgdev-originals.s3.amazonaws.com/fp9emn.jpg');
            header('Content-type: image/'.end($ext));
            echo $contents;
        }
    

    And access the image by using that php file, like if the file is called generateImage.php you can do and the external image url can be a get parameter for the file

提交回复
热议问题