Can we control which responsive images get generated via Media Library?

I’m using Cloudinary with my Strapi instance, the option to generate the responsive friendly versions of images is really handy but I’m only using 3 of the 5 images that get generated, which is quite a lot of wasted database rows and image hosting on Cloudinary.

Is there a way to select only certain options? If not, that would be a handy feature.

Hey @josh, no it is currently not possible the formats are hardcoded configured in.
But I spoke to someone, that was looking into a PR to add some config for the format sizes and disabling them. Will come back to you if it is merged.

5 Likes

That would be fantastic, thanks @MattieBelt!

@MattieBelt Hello, I have the same question. Has his problem been solved yet? Regards! :slight_smile:

You can try to delete unused sizes from breakpoints, by using extensions

1 Like

Hey @mingxi, no I spoke with the guy but he didn’t have any time to implement something by default. I gave it a try, but now I have no time to finish it. But with extensions as @sunnyson replied will work for now.

1 Like

@MattieBelt Thanks for the reply! :+1: This wish is not so important, but it would be a “Nice to Have” function or option. At the moment my program is running on “Extensions” already. I’m in no hurry and I am quite sure that there will be a good solution soon. :beer:

2 Likes

hi everyone. I have one question. I have deploy Strapi to heroku. I have upload image and less than a day later the picture was lost. This is problem?

Hi,

you can now customize the breakpoints which will generate the responsive images:

module.exports = {
  upload: {
    breakpoints: {
      xlarge: 1920,
      large: 1000,
      medium: 750,
      small: 500,
      xsmall: 64
    }
  }
}

You can find more informations here: Upload - Strapi Developer Documentation

Hi,

Yes unfortunately Heroku doesn’t support local uploading files.

You can find more informations about it in the documentation: Heroku Deployment - Strapi Developer Documentation

You can use AWS S3 provider in order to host your files, they have a free tier which is, I think, around 5 GB of storage :wink:

1 Like

Hi everyone,

I was wondering where do I see these multiple file sizes? I only have access to a single url from media library. Where are the others? Do they just have small_ medium_ and large_ prepended in front of the original filename? Also, why is Strapi generating random characters after the filenames even if I don’t already have a file with the same filename? As an example, when I upload strapitest.jpg I get /uploads/strapitest_52de418f82.jpg. Thank you for your help.

At the moment it’s not possible to see them in the media library, they are only returned by the API itself.

Thank you. Can you please let me know why Strapi is adding random characters to file names? When I upload strapitest.jpg I get something like strapitest_3952997ab3.jpg as the link.

Duplication protection, for example say you had some mobile app uploading pictures. iPhones or most Android phones for example save it like img_1234.png. If you had 10 users all happen to upload a file with that same name, one could replace the other. So we add a random string to prevent that from happening.

1 Like

Hi, I have deployed my Strapi on Heroku PaaS. And I am using Cloudinary for images storage.

Whenever I upload an asset, it works fine and the image gets uploaded to Cloudinary successfully.

But the problem is that I don’t see the multiple versions of that image in the Media Library.

I have checked the Cloudinary and verified that multiple versions of images are getting generated and stored in the Cloudinary.

I’ll be very thankful to you for help.

How do we configure the breakpoint for the thumbnail?