Does Flickr support CORS? SECURITY ERROR with getI

2019-03-29 13:06发布

问题:

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.