Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

398
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!