Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

400
Visualizações
Does Cloudflare images support svg?

I'm using the images api to upload a bunch of images to Cloudflare. But I'm having trouble with the svgs ones... does anybody knows if Cloudflare supports them? I'm not finding any docs for that. Thanks!

I'm getting this error when running the code. 'ERROR 9422: Decode error: image failed to be decoded: Uploaded image must have image/jpeg or image/png content type\n'

My code:

let imageUrl = "";
  // We get the datoCMS image upload id and fetch the url, then we post it in cloudfare
  const image = await datoManagementPrimaryEnvironment.upload.find(uploadId);

  const fileName = title ? title : image.basename ? image.basename : "image";

  const response = await axios.get(image.url, { responseType: "stream" });

  const form = new FormData();
  // Pass image stream from response directly to form
  form.append("file", response.data, `${fileName}`);

  try {
    const postRes = await axios
      .post(
        `https://api.cloudflare.com/client/v4/accounts/${cloudfareId}/images/v1`,
        form,
        {
          headers: {
            ...form.getHeaders(),
            Authorization: `Bearer ${cloudfareApiKey}`,
          },
        }
      )
      .then((fetchRes) => {
        return (imageUrl = fetchRes.data.result.variants[0]);
      });
    return postRes;
  } catch (error) {
    console.error("Error while uploading to cloudflare", error);
  } finally {
    return imageUrl;
  }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda