-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
兼容BASE64图片内容 #159
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
想要兼容BASE64需要改动这两个文件,Html.class,以及AreImageGetter.class。
在AreImageGetter.class文件找到getDrawable(),加入判断:
else if (source.startsWith("data:image")){
// data:image/jpg;base64
AreUrlDrawable areUrlDrawable = new AreUrlDrawable(mContext);
BitmapTarget bitmapTarget = new BitmapTarget(areUrlDrawable, mTextView);
try {
//ImageUtil.INSTANCE.str2Bitmap(source);
//此方法为转bitmap方法,source为base64字符串
Bitmap s = ImageUtil.INSTANCE.str2Bitmap(source);
sGlideRequests.asBitmap().load(s).into(bitmapTarget);
return areUrlDrawable;
} catch (Exception ignored) {
ignored.printStackTrace();
}
}
在Html.class文件找到startImg(),加入判断:
else if (src.startsWith("data:image")){
imageSpan = new AreImageSpan(sContext, d, src);
}
The text was updated successfully, but these errors were encountered: