How do I display images from Google Drive on a website?

前端 未结 17 1942
傲寒
傲寒 2020-12-02 05:35

A client of mine has uploaded some photos to their Google Drive and would like me to display their photos on their company website. I reviewed the documentation for displayi

相关标签:
17条回答
  • 2020-12-02 06:35

    Example of Embedding a Google Drive Image

    Original URL: https://drive.google.com/file/d/0B6wwyazyzml-OGQ3VUo0Z2thdmc/view

    Photo by Paula Borowska

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Google Drive</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    
    <body>
        <img src="https://drive.google.com/uc?export=view&id=0B6wwyazyzml-OGQ3VUo0Z2thdmc">
    </body>
    
    </html>

    Thank You https://codepen.io/jackplug/pen/OPmMJB

    0 讨论(0)
  • 2020-12-02 06:35

    I don't know of a better way but you can datamine the page with php. For instance if you go to google and share a folder then go to that folder it will look something like

    https://drive.google.com/folderview?id=0B8TT0olkjsdkfji9jekbFF4LWc&usp=sharing

    ^^^ not a real link

    What you are looking for is the individual images inside the source code of this page

    then using php get the source code with

    <? $f = fopen ("http://www.example.com/f", r);
    echo $f;
    ?>
    

    now $f has the source and you can use other php commands to seperate only the URLS with the images you want. It will take a bit of work but highly doable.

    once you have these image links showing the way you want just build them into a div or table structure to display on a gallery maybe even add a greybox element for effect

    0 讨论(0)
  • 2020-12-02 06:36

    List View

    <iframe src="https://drive.google.com/embeddedfolderview?id=YOURID#list" width="700" height="500" frameborder="0"></iframe>

    Grid View

    <iframe src="https://drive.google.com/embeddedfolderview?id=YOURID#grid" width="700" height="500" frameborder="0"></iframe>

    Read More at: https://thomas.vanhoutte.be/miniblog/embed-add-google-drive-folder-file-website/

    0 讨论(0)
  • 2020-12-02 06:38

    Google Drive Hosting is now deprecated. It stopped working from August 31, 2016.

    hosting on Google Drive - deprecation schedule

    I have removed the explanation of how to previously host an image on Google Drive.

    0 讨论(0)
  • 2020-12-02 06:38
    <img src="https://drive.google.com/uc?export=view&id=Your_Image_ID" alt="">
    

    I use on my wordpress site as storing image files on local host takes up to much space and slows down my site

    I use textmate as it is easy to edit multiple URLs at same time using the 'alt/option' button

    0 讨论(0)
提交回复
热议问题