Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: remove same origin requirement for API images #26

Open
michealparks opened this issue Jul 22, 2019 · 6 comments
Open

Request: remove same origin requirement for API images #26

michealparks opened this issue Jul 22, 2019 · 6 comments

Comments

@michealparks
Copy link

Screen Shot 2019-07-21 at 10 23 16 PM

This restriction limits client side apps attempting to make use of the https://metmuseum.github.io API

@bravokiloecho
Copy link

I have a use case that requires this and it would be very lovely for the images to be accessible in this way

@stephenhmarsh
Copy link

It seems CORS headers have been removed from images.

Behold your image https://images.metmuseum.org/CRDImages/ep/original/DT8844.jpg:

cc @spencerk

@esDotDev
Copy link

esDotDev commented Aug 24, 2023

@stephenhmarsh Is it possible this has been regressed? We're trying to load images using Flutter client, and getting this error:

image

@esDotDev
Copy link

@stephenhmarsh
Copy link

thanks @esDotDev - especially appreciate the examples. we've created an internal ticket to look into it. cc @spencerk

@stephenhmarsh stephenhmarsh reopened this Aug 25, 2023
@esDotDev
Copy link

esDotDev commented Sep 1, 2023

@stephenhmarsh @spencerk Thanks for looking into this! Here is an interactive example, one button downloads from unsplash.com which works, the other downloads from metmuseum.org and fails:
https://jsfiddle.net/54f21ue3/11/

<button onclick="downloadImage('https://images.metmuseum.org/CRDImages/ep/original/DT8844.jpg')">Download MET Image</button>

<button onclick="downloadImage('https://images.unsplash.com/photo-1512813389649-acb9131ced20')">Download Unsplash Image</button>

<script>
  function downloadImage(url) {
    fetch(url)
      .then(resp => resp.blob())
      .then(blob => {
        const url = window.URL.createObjectURL(blob);
        const a = document.createElement('a');
        a.style.display = 'none';
        a.href = url;
        var fileName = url.split(/[#?]/)[0].split('/').pop();
        a.download = fileName;
        document.body.appendChild(a);
        a.click();
        window.URL.revokeObjectURL(url);
      })
      .catch((e) => alert('An error occurred while downloading the image.\n' + e));
  }

</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants