We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 669b0fb commit 86198bbCopy full SHA for 86198bb
gma/src/android/native_ad_image_android.cc
@@ -71,6 +71,15 @@ NativeAdImage::NativeAdImage(
71
FIREBASE_ASSERT(j_uri);
72
internal_->uri = util::JniUriToString(env, j_uri);
73
74
+ // Images requested with an android user agent may return webp images. Trim
75
+ // webp parameter from image url to get the original JPG/PNG image.
76
+ std::size_t eq_pos = internal_->uri.rfind("=");
77
+ std::size_t webp_pos = internal_->uri.rfind("-rw");
78
+ if (webp_pos != std::string::npos && eq_pos != std::string::npos &&
79
+ webp_pos > eq_pos) {
80
+ internal_->uri.replace(webp_pos, 3, "");
81
+ }
82
+
83
// NativeAdImage scale.
84
jdouble j_scale =
85
env->CallDoubleMethod(internal_->native_ad_image,
0 commit comments