我正在尝试创建一个包含我从flickr获取的图像的表格。我传入的数组包含以下网址:
["https://www.flickr.com/photos/113081696@N07/24695273486", "https://www.flickr.com/photos/113081696@N07/24565358002", "https://www.flickr.com/photos/113081696@N07/24033705054", "https://www.flickr.com/photos/30607051@N00/23928266355", "https://www.flickr.com/photos/30735982@N00/23241595406", "https://www.flickr.com/photos/57453294@N00/21232117675", "https://www.flickr.com/photos/57453294@N00/21197130905"]
当我尝试将img标签上的src设置为等于其中一个值时:
var photo = document.createElement("img");
photo.src = arr[i];
我只是得到了一堆破碎的图片图标。我不能以这种方式使用flickr吗?
答案 0 :(得分:2)
img标记的java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
at com.app.android.databinding.ActivityRestaurantDetailsBinding.executeBindings(ActivityRestaurantDetailsBinding.java:381)
at android.databinding.ViewDataBinding.executePendingBindings(ViewDataBinding.java:350)
at android.databinding.ViewDataBinding$6.run(ViewDataBinding.java:167)
at android.databinding.ViewDataBinding$5.onViewAttachedToWindow(ViewDataBinding.java:137)
at android.view.View.dispatchAttachedToWindow(View.java:14525)
应该是图片的网址,但是
src
是一个HTML文档
您可以使用该页面上的分享按钮获取可嵌入您网站的HTML代码,并查看其中的操作:
https://jsfiddle.net/s4odszqL/
<强>更新强>
如果您使用的是flickr api,则可以使用getInfo获取照片的https://www.flickr.com/photos/113081696@N07/24695273486
,然后按以下格式创建照片网址here
答案 1 :(得分:1)
知道了!我必须使用以下内容来使用flickr的静态网站:
"https://farm" + key.farm + ".staticflickr.com/" + key.server + "/" + key.id + "_" + key.secret + ".jpg";