<commit_before>export function createGeminiUrl({
  imageURL,
  width,
  height,
  geminiHost = "d7hftxdivxxvm.cloudfront.net",
  imageQuality = 80,
  resizeMode = "fit",
}: {
  imageURL: string
  width: number
  height: number
  geminiHost?: string
  imageQuality?: number
  resizeMode?: "fit" | "fill"
}) {
  const src = encodeURIComponent(imageURL)

  const params = [
    `height=${height}`,
    `quality=${imageQuality}`,
    `resize_to=${resizeMode}`,
    `src=${src}`,
    `width=${width}`,
  ]

  params.push("convert_to=webp")

  return `https://${geminiHost}/?${params.join("&")}`
}
<commit_msg>fix: don't use webp on unsupported os versions (#7604)<commit_after>import { osMajorVersion } from "app/utils/platformUtil"
import { Platform } from "react-native"

export function createGeminiUrl({
  imageURL,
  width,
  height,
  geminiHost = "d7hftxdivxxvm.cloudfront.net",
  imageQuality = 80,
  resizeMode = "fit",
}: {
  imageURL: string
  width: number
  height: number
  geminiHost?: string
  imageQuality?: number
  resizeMode?: "fit" | "fill"
}) {
  const src = encodeURIComponent(imageURL)

  const params = [
    `height=${height}`,
    `quality=${imageQuality}`,
    `resize_to=${resizeMode}`,
    `src=${src}`,
    `width=${width}`,
  ]

  if (Platform.OS === "android" || (Platform.OS === "ios" && osMajorVersion() >= 13)) {
    params.push("convert_to=webp")
  }

  return `https://${geminiHost}/?${params.join("&")}`
}

{'fraction_non_alphanumeric': 0.17777777777777778, 'fraction_numerical': 0.008333333333333333, 'mean_word_length': 4.20216606498195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2556041', 'n_tokens_mistral': 530, 'n_tokens_neox': 505, 'n_words': 99}