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

470
Views
Strapi: Problem uploading images to strapi, image does not render

Problem

I would like to know if you can help identify the issue related to uploading an image to the thumb field belonging to the content-type Directory.

The image image does not render once it is in the strapi panel, it only shows the name.

const getFileSize = (filePath) => {
  return statSync(filePath)["size"]; // statSync from `fs-extra` library
};


 strapi.service("api::directory.directory").create({
      data: {},
      files: {
        thumb: {
          path: `${imagesDir}/Crab-1-1-scaled.jpg`,
          name: "Crab-1-1-scaled.jpeg",
          type: mime.lookup(`${imagesDir}/Crab-1-1-scaled.jpg`), // mime from `mime-types` library
          size: getFileSize(`${imagesDir}/Crab-1-1-scaled.jpg`),
        },
      },
    });

console.log

size is always zero

{
  files: {
    thumb: {
      path: 'src/scripts/Directory/images/Crab-1-1-scaled.jpg',
      name: 'Crab-1-1-scaled.jpeg',
      type: 'image/jpeg',
      size: 0
    }
  }
}

output

When uploading the data the image is not rendered, it only shows the name of the image.

enter image description here

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!