我想在我的網站上嵌入20張Instagram照片。這些照片是爲每個頁面不同,我收到的所有在PHP數組的Instagram的URL在本格式嵌入多張Instagram照片的最有效方法是什麼?
https://instagram.com/p/xxxxxxxxxx/media/?size=m
我目前只使用一個foreach循環和嵌入他們這樣
<img src="https://instagram.com/p/xxxxxxxxxx/media/?size=m">
<img src="https://instagram.com/p/xxxxxxxxxy/media/?size=m">
<img src="https://instagram.com/p/xxxxxxxxxz/media/?size=m">
我認爲這不是最有效的方法,因爲每個圖像的src必須重定向到實際的源。
我發現的唯一的另一種方法是這樣的URL
https://api.instagram.com/oembed/?url=https://instagram.com/p/xxxxxxxxxx/media/?size=m
但使用這種方法將意味着我需要的JSON解碼每個圖像找到它的實際來源。
有沒有一些方法,我可以在https://instagram.com/p/xxxxxxxxxx/media/?size=m URL轉換爲直接圖像URL沒有幾十個服務器調用的?
你關心的是在Instagram服務器上解析這些URL,對吧?我不擔心它,除非你有一些實際的性能問題... Instagram的CDN,緩存等設置服務這些圖像 –