Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

399
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda