Reputation:
I would like to be able to take pictures from folder on google drive and run it on my website.
I have a java script slider but I have no idea how to take the pictures from google drive until now I took it from local folder.
This is the java script:
<img class="mySlides myImg" src="Images/Image_01.jpeg" alt="Pasta, Tasty" width="620" height="340">
<!-- Slider Image Script -->
<script>
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentDiv(n) {
showDivs(slideIndex = n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" w3-white", "");
}
x[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " w3-white";
}
</script>
Upvotes: 2
Views: 3786
Reputation: 17613
Hosting resources from Google Drive has long been discontinued, but for the images, you can try using the Files: get to fetch the webContentLink which you can then display in your img src like:
< img src="https://drive.google.com/uc?id=FILE_ID_HERE&export=download" >
Upvotes: 3