Comments (6)
Hi,
You mean how to handle static images uploaded by collectstatic
command? If that is the case, unfortunately all static files currently are uploaded as Cloudinary Raw type, which indeed is not always what you want, static images should be uploaded as images, static movies as movies.
So there is a need to distinguish between different types of static files. I guess the easiest would be to provide extensions for images and movies (and it would be configurable in settings.py
). Those are files which web developer is in control of, so we really don't need to validate those (in contrast to media files).
After this, you could use pycloudinary
template tags like for media files example in this package's readme:
{% load cloudinary %}
{% cloudinary test_model_instance.image.name width=100 height=100 %}
What do you think about this solution? If that is fine, I will implement this soon.
from django-cloudinary-storage.
Yeah, exactly! Cloudinary is awesome in that I don't need to come up with 4+ variants of the same image (x1/x2, jpg/webp) and can choose its resolution in the place of use. It would be nice to have the ability for static files, too.
I can't find any downsides in your solution. The only thing to add would be an ability to provide a general predicate over the path. It can be useful during gradual migration, like when you have both old and pre-compressed assets (those are better treated as "raw"), and new high-res ones.
Thanks a lot for your swift reply and a proposed implementation!
from django-cloudinary-storage.
No problem, and yeah, I agree, transformations for static images are indeed a necessary feature :)
Could you please explain what do you mean by general predicate over the path? Some filter not based on file extension only? Could you give an example?
And why is it better to upload old and pre-compressed images as raw files, does Cloudinary make any optimizations for raw files?
from django-cloudinary-storage.
I have just made new release. Please let me know if everything is covered now.
from django-cloudinary-storage.
I'm really sorry for a delayed reply.
I didn't have the time to look into the feature yet (had a slight change in priorities), but I'll definitely do! Thanks a lot for making it a reality in such a short time, it's unbelievable :)
from django-cloudinary-storage.
No problem :) I hope you will find this new feature useful :)
from django-cloudinary-storage.
Related Issues (20)
- Setting for prefix HOT 3
- Implement upload options HOT 1
- File size too large -- but it isn't HOT 7
- How to get the full path HOT 5
- How can I delete an image each time I delete the instance asociated with it? HOT 4
- Add ability to manipualate option upload in settings.py HOT 1
- Django-utils.six dropped in Django 3.x HOT 9
- Unable to load large videos HOT 3
- Cannot find valid magic files. HOT 8
- Switch to Poetry with better dependency pinning
- issue with exists for raw files HOT 3
- Issue with uploading Django CKEditor images to cloudinary HOT 7
- This backend doesn't support absolute paths HOT 3
- This backend doesn't support absolute paths. HOT 2
- Unsupported video format or file HOT 3
- Can I set uppload option to private? HOT 5
- Static files don't work HOT 4
- How to apply cloudinary transformations outside of templates
- expected str, bytes or os.PathLike object, not NoneType HOT 1
- Error during management command: deleteredundantstatic
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-cloudinary-storage.