Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete source image after variations created #248

Closed
sandnima opened this issue Jun 30, 2021 · 1 comment
Closed

Delete source image after variations created #248

sandnima opened this issue Jun 30, 2021 · 1 comment
Assignees
Labels

Comments

@sandnima
Copy link

I was thinking of an argument for deleting the main uploaded image after creating a standard sized
sometimes we use just standard sizes and don't need the uploaded image with a huge size in the media folder, then it would be great if there is an option like this to remove the original image after processing

class MyModel(models.Model):
    image = StdImageField(
        upload_to='path/to/files',
        variations={'thumbnail': (100, 75)},
        delete_orphans=True,
        blank=True,
        delete_original=True,
    )
@codingjoe codingjoe self-assigned this Jul 6, 2021
@codingjoe
Copy link
Owner

Hi @sandnima,

Thank you for reaching out. We keep the original by default because it's best to generate new variations from the original source, rather than a compressed copy. A simple example would be a design update. Maybe you need an image at a different ration, you can simply create new variations and render them. However, that does only work, if you keep the original.

To prevent users from learning this lesson the hard way, we keep the source image by default. That being said, you can probably create a subclass that ditches the original, but I would advise against it, for the reasons above.

I hope this answered your question.

Best,
Joe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants