Glide 不会加载一些图片 URL

Glide won't load some image URLs

我创建了 Restful Api,因此用户可以与我的服务器数据库进行通信。首先,我将用户从图库中选择的图像上传到数据库中,使用将位图转换为字符串的函数:

public String getStringImage(Bitmap bmp){
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.JPEG, 50, baos);
    byte[] imageBytes = baos.toByteArray();
    return Base64.encodeToString(imageBytes, Base64.DEFAULT);
}

之后,我将图像路径存储在数据库中,并使用 PHP 中的这些代码对编码图像进行解码:

if (!is_null($image)) {
    file_put_contents($pathToImage, base64_decode($image));
}

图像的结果是这样的:

http://ashfoundation.net/uploads/82.png

当我尝试从适配器获取此 url 时,我什么也没得到。这是我使用的代码:

String imagePath = joke.getImagePath();

        Uri uri = Uri.parse(imagePath);

if (Uri.EMPTY.equals(uri)) {
            viewHolder.feedImage.setVisibility(View.GONE);
        } else {
            Glide.with(mContext)
                    .load(uri)
                    .fitCenter()
                    .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                    .into(viewHolder.feedImage);
        }

我知道 url 有问题,因为当我尝试加载一些随机的 url 时:

https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png

它正在工作。那么我的 URL 有什么问题吗?

如果有人遇到和我一样的问题,别忘了输入

http:// 为您存储在数据库中的图像路径。我就是这样:

我这样做是错误的:

if($image === 'null') {
    $actualpath = "null";
} else {
    $actualpath = "ashfoundation.net/$path";
}

它应该是这样的:

if($image === 'null') {
    $actualpath = "null";
} else {
    $actualpath = "http://ashfoundation.net/$path";
}