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

Fetch and display all the collection's images in the sidebar #1013

Closed
Tracked by #998
PeculiarE opened this issue Aug 22, 2022 · 4 comments · Fixed by #1028
Closed
Tracked by #998

Fetch and display all the collection's images in the sidebar #1013

PeculiarE opened this issue Aug 22, 2022 · 4 comments · Fixed by #1028

Comments

@PeculiarE
Copy link
Collaborator

PeculiarE commented Aug 22, 2022

On inputting a valid Internet Archive URL, the images saved in that collection should be displayed on the sidebar.

@jywarren
Copy link
Member

jywarren commented Sep 12, 2022

Let's be aware that we'll need jQuery in there -- with <script src='https://code.jquery.com/jquery-3.6.1.min.js'></script>

and Leaflet used to use the same shortcut - $ so if both libraries try to, there could be an issue. Try inserting that code below the leaflet code so hopefully it overwrites Leaflet's use of $, and we don't have any trouble. But watch out if it says it $.get is not defined!

Quoting from #998 --

Code to fetch a gallery (CORS is now enabled for IA images) using jQuery $.get() function:

$.get('https://archive.org/metadata/texas-barnraising/',function(response) { console.log(response) })
{readyState: 1, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …}

=> VM8221:1 {created: 1657632500, d1: 'ia600904.us.archive.org', d2: 'ia800904.us.archive.org', dir: '/27/items/texas-barnraising', files: Array(25), …}

// Then we add "https://archive.org/download/" + collection_name + "/" + filename like this:

i = new Image; i.src = "https://archive.org/download/texas-barnraising/IMG_0764.JPG";

=> 'https://archive.org/download/texas-barnraising/IMG_0764.JPG'
// That will redirect/resolve to something like: https://ia801507.us.archive.org/34/items/texas-barnraising/IMG_0764.JPG

i.width

=> 2592

See a full example returned response for the above query here: https://gist.github.com/jywarren/12d0d2b8483339e9c2c7b1ad635f6d79

@PeculiarE
Copy link
Collaborator Author

Hmmm...I used pure JS with axios instead. And yes, there's no clash of any sort. Is this okay, or must we use jQuery?

@jywarren
Copy link
Member

jywarren commented Sep 20, 2022 via email

@PeculiarE
Copy link
Collaborator Author

Alright! Thanks, Jeff 😄

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

Successfully merging a pull request may close this issue.

2 participants