I have nothing to do recently. I want to learn the technology of stealing links to grab pictures from other people"s web pages. But recently encountered a strange problem, when using Glide and OkHttpUtils to load pictures, Glide unexpectedly failed to load pictures and OkHttpUtils succeeded. I hope God will give me some advice. Explain why Glide didn"t succeed. Is there a solution?
set header using Glide but did not get the picture. The code is as follows:
Glide.with(context)
.load(new GlideUrl(url, new LazyHeaders.Builder().addHeader("Referer", "https://******").build()))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.thumbnail(0.5f)
.into(imageView);
set header using OkHttpUtils to get the picture successfully. The code is as follows:
OkHttpUtils.get().url(url).addHeader("Referer","https://******").build().execute(new BitmapCallback() {
@Override
public void onError(Call call, Exception e, int code) {
LogUtil.i(e.toString());
}
@Override
public void onResponse(Bitmap response) {
img.setImageBitmap(response);
}
});