-
Notifications
You must be signed in to change notification settings - Fork 276
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
Need official way to have thumbnails created and stored in database like ImageField when saving model #464
Comments
The idea behind ImageKit is simple:
The size of the thumbnails depends on design and design can change. If tomorrow you want differently sized images or with some effects applied, you simply change parameters in code (which can be in templates and not in models). When deployed the images will be automatically generated on first request. There is no need to store the thumbnail in the model when we have the source field. Now for performance reasons some people decide to store the thumbnails in their database next to original image. ImageKit was not designed with this in mind. If someone is willing to try to implement it as a feature I will be very happy to review the work. It will conflict with the principles behind ImageKit but if this is what community wants - so be it. If you think that the benefit to change any parameter of the thumbnail image at any time, without the need to run some custom migration which need to rebuild all images to match the new design (and until the migration finishes some parts of the site can look broken because images are not yet rebuild) outweighs the inconvenience of these custom migrations for rebuilding images, then we can look at better ways of using the ImageKit cache strategy. I still think that the cache strategy of ImageKit can do a good job. Probably there need to be some improvements, especially around custom storage engines like S3 or other remote slow ones. I'm open to concrete proposals with merge requests. |
Listing the "complicated and error prone" things might be valuable. Maybe somebody could think of a better way to address them than what you've considered. @vstoykov is running the show now but FWIW, I think of IK like this:
If you want to generate the image immediately, that's what the cache file strategies are for—you shouldn't have to do manual post_save stuff. |
I think the cache strategy of ImageSpecField for thumbnails is complicated and error-prone, especially when using Imagekit with Django Rest Framework and external storage backend.
What I want is having several thumbnail fields in model, when uploading a file and saving model, thumbnails will be generated and saved as well.
Like the following, when photo uploaded, thumbnail fields should be automatically generated and saved.
there are tricks to do it with Imagekit (like #341 , #333), I use post_save to manually generate thumbnails and save them and it also works, but these tricks are ugly and not perfect.
I think it's good if there is an official way to do it with Imagekit, maybe as a new feature if needed.
The text was updated successfully, but these errors were encountered: