Does Flickr support CORS? SECURITY ERROR with getImageData

限于喜欢 提交于 2019-12-09 13:09:20

问题


Hello dear community.

I'm trying to create extract colors from images fetched from Flickr. That all works really great to the point when I try to process that images in canvas with getImageData().

As described through WHATWG loading an image into canvas set a flag so you cannot maniplate that. So my question is does FLICKR support CORS?

<script type="text/javascript">

    var img= new Image;  
    var canvas = document.getElementById('canvas');
    var ctx = canvas.getContext('2d');  
            var src = "fetched-flickr-image-url";  
        img.crossOrigin = "Anonymous";          
        img.src = src;
        img.onload = function() {    
        ctx.drawImage( img, 0, 0 );  
        var image_data = ctx.getImageData(0, 0, 100, 100);//Throw the Security error        
            }         
          });

</script>

I also tried to do the image processing in but thats a really heavy process (took about 4mins to process 250 images).

If you have any clues just ping me.


Enviroment: Mac OSX, HTML5, jQuery


回答1:


Not yet; see here for discussion.

They now appear to be sending CORS headers for images but with Access-Control-Allow-Origin: http://www.flickr.com, which isn't much help but at least they're sending the headers now.



来源:https://stackoverflow.com/questions/8415130/does-flickr-support-cors-security-error-with-getimagedata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!