question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Variants are not re-generated on overwrite image

See original GitHub issue

Thanks for putting efforts into this great package! I found this one most relevant to my requirement, among several django imaging libraries.

The only issue I’m having is variants don’t get regenerated when you replace an existing image.

It works fine locally (django.core.files.storage.FileSystemStorage), but not on S3 (storages.backends.s3boto3.S3Boto3Storage). Only main image is replaced, and thumbnail variants remain untouched.

  • main_image.png (replaced with new one)
  • main_image.md.png (untouched, old)
  • main_image.sm.png(untouched, old)

My workaround was to add random hash to file name so that set of 3 new images are created on S3 bucket, each time you replace. It’s not good enough since old images hold the space.

It would be great if someone can take a quick double check, and fix if easy.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
codingjoecommented, Jul 23, 2019

@mingthegit as much as I agree with the problem, I would caution you a bit regarding the solution. Please keep in mind, that changing the behavior should not be done quietly. Currently, existing variations are not overridden. So if we are to change the behavior, we need to do it in a way, that informs users should the update.

1reaction
codingjoecommented, Aug 28, 2019

@caspervk I know it’s default behavior in Python, but not in Django storage backends. I don’t know why they chose this path. But I guess it’s to prevent users from errors. I merged it, it’s released in 5.0.1

Thank you so much for your contribution. It is very much appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove old variants with Rails ActiveStorage - Stack Overflow
I had some time to dig into ActiveStorage. Turns out, variants are stored with the variants/ prefix, which makes finding them a lot...
Read more >
WebP images are not regenerated when using ... - Drupal
Problem/Motivation If I apply a crop for an image, it crops the jpg and webp images fine. But if I change the crop...
Read more >
Changing Image Sizes: And regeneration - WordPress.org
I want to change the standard pixel size of “Medium” images to say.. 600×450. I am using webp. To regen the images and...
Read more >
Flexible variants - Cloudflare Image Optimization
Flexible variants allow you to create variants with dynamic resizing. This option is not enabled by default. You can enable flexible variants ...
Read more >
different images with the same name overwrite each other - Jira
This is a feature, we automatically version the images for you if you upload a file with the same filename. The best way...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found