0

How can is get the photos stored in a Google Photos Album via an API using AJAX? The method of using jQuery Fancybox seems relatively simple and fetches images via AJAX with no issue if I have the correct path.

The link for the album is https://photos.google.com/share/AF1QipPMSlvhP4RGfwoo6lt44dbR2dWQTFeuMXb7Ow37yxjzH9iPYwxpjtNuDy3FJJ8vJQ?key=bjBfak5RMDVZeDJ4OU1fVnVyZDY3ZUNlSVBUemFn

and I am using the method suggested by Fancybox as

<a data-fancybox data-type="ajax" data-src="/path/to/ajax/" href="javascript:;">Gallery</a>

I am sure that Google must give the ability to do so but I just cannot find where.

<link href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.min.js"></script>

<a data-fancybox data-type="ajax" data-src="https://photos.google.com/share/AF1QipPMSlvhP4RGfwoo6lt44dbR2dWQTFeuMXb7Ow37yxjzH9iPYwxpjtNuDy3FJJ8vJQ?key=bjBfak5RMDVZeDJ4OU1fVnVyZDY3ZUNlSVBUemFn" href="javascript:;">Gallery</a>
Darren
  • 2,176
  • 9
  • 42
  • 98
  • Try running your snippet with the console tab open in your browser's developer tools. Using Chrome, this error message displays: `No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.` You're encountering a CORS issue. – SimianAngel Jan 28 '18 at 03:12
  • Thank you @SimianAngel. I did do that and expected the response was due to the URL used. I only put that as an example but imagine that Google has a way to pull the URL's of each image via AJAX. I just cannot find it in the API Library or documentation to suggest so. – Darren Jan 28 '18 at 03:15
  • Perhaps something from the Google Picasa Web API? https://developers.google.com/picasa-web/ Though at first glance there's not mention of a JavaScript method among the code example languages listed. – SimianAngel Jan 28 '18 at 03:22
  • Cheers. I will check that out now. – Darren Jan 28 '18 at 03:27

0 Answers0