Giter VIP home page Giter VIP logo

Comments (6)

klis87 avatar klis87 commented on May 20, 2024

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.

si14 avatar si14 commented on May 20, 2024

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.

klis87 avatar klis87 commented on May 20, 2024

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.

klis87 avatar klis87 commented on May 20, 2024

I have just made new release. Please let me know if everything is covered now.

from django-cloudinary-storage.

si14 avatar si14 commented on May 20, 2024

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.

klis87 avatar klis87 commented on May 20, 2024

No problem :) I hope you will find this new feature useful :)

from django-cloudinary-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.