我已经采用两种方法使用滑动来从firebase存储中获取图像。第一种方法工作正常,因为在获得downloadUrl后,它使用滑动加载图像。
但第二个更方便,但它不适合我。
buidl.gradle:app
dependencies {
// ..... not included glige dependency
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
}
第一种方法(工作):
// question.imgQuestion = "qimgs/-KiTpzP5t-xJOO5nSK0A/1493896460324-ch1pg2.jpg"
final StorageReference ref = mStorage.getReference().child(question.imgQuestion);
ref.getDownloadUrl().addOnSuccessListener(this, new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Log.i(TAG, "Download URL : " + uri); // https://firebasestorage.googleapis.com/v0/b/questionpaper-ce229.appspot.com/o/qimgs%2F-KiTpzP5t-xJOO5nSK0A%2F1493896460324-ch1pg2.jpg?alt=media&token=ca2a3f6e-3eb5-4088-a48d-069ac8ad640b
Glide.with(QuizActivity.this)
.load(uri)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.into(mImageQuestion);
}
});
第二种方法(不工作,但我想要这个)
// question.imgQuestion = "qimgs/-KiTpzP5t-xJOO5nSK0A/1493896460324-ch1pg2.jpg"
final StorageReference ref = mStorage.getReference().child(question.imgQuestion);
Glide.with(QuizActivity.this)
.using(new FirebaseImageLoader())
.load(ref)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.into(mImageQuestion);
注意:此firebase存储实例是经过身份验证的实例。
答案 0 :(得分:0)
StorageReference imagepath = storageReference.child("Images");
imagepath.putFile(selectedImage).addOnSuccessListener(new
OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
getimage = taskSnapshot.getDownloadUrl();
Glide.with(QuizActivity.this)
.using(new FirebaseImageLoader())
.load(getimage)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.into(mImageQuestion);
}
});
试试这个,这对我有用
答案 1 :(得分:0)
我也有这个问题,结果发现最新版本的firebase SDK(10.2.4)导致了这个问题,所以我恢复到了10.2.1,一切都很顺利。
答案 2 :(得分:-1)
将 function plotChartData(dataSeries, xaxisTitle)
{
myChart = new Highcharts.Chart({
chart: {
renderTo: 'chartSpace',
type: 'line',
zoomType: 'xy',
panning: true,
panKey: 'shift',
plotBorderWidth: 1,
events: {
dblclick: function (e) {
window.alert('Hello Chart!')
}
}
},
title: {
text: 'Fixed Tooltip'
},
legend: {
layout: 'horizontal',
align: 'left',
itemDistance: 10,
borderWidth: 0,
itemMarginTop: 0,
itemMarginBottom: 0,
padding: 20
},
plotOptions: {
series: {
states: {
hover: {
enabled: false
}
},
dataLabels: {
enabled: false,
format: '{y}'
},
allowPointSelect: false
}
},
xAxis: {
type: 'datetime',
labels: {
rotation: -65,
style: {
fontSize: '9px',
fontFamily: 'Verdana, sans-serif'
}
},
crosshair: true
},
yAxis: {
gridLineColor: '#DDDDDD',
gridLineWidth: 0.5
},
tooltip: {
positioner: function () {
return { x: 80, y: 10 };
},
pointFormat: '{series.name}: <b>{point.y}</b><br/>',
split: true,
valueDecimals: 2,
shadow: false,
borderWidth: 0,
backgroundColor: 'rgba(255,255,255,0.8)'
},
series: [{
name: xaxisTitle,
data: dataSeries
}]
});
}
替换为.load(ref)
.load(ref.getDownloadUrl())