Giter Site home page Giter Site logo

Comments (7)

tuttle avatar tuttle commented on August 18, 2024

There's in fact yet another way. The thumbnail w/h are the functions of the source-image's w/h plus the thumbnail_options dict.

In case e-t will provide the calculation API for the code it internally uses like

size_tuple = e-t.utils.thumbnail_dimensions(src_size_tuple, thumbnail_options)

then I'd store the source image w/h in my app's model and upon any image retrieval I'd be able to simply provide the w/h for any image together with its CloudFiles URL.

from easy-thumbnails.

SmileyChris avatar SmileyChris commented on August 18, 2024

That [calculating thumbnail dimensions based on source dimensions] sounds like a good way... it'd probably mean having to refactor the processors so they can somehow return size information without actually bothering to muck with PIL.

The other solution would be to add the dimension info to the database cache record of the thumbnail images, but then it's making the rows (slightly) larger for everyone, even if they don't care about the dimensions.

from easy-thumbnails.

tuttle avatar tuttle commented on August 18, 2024

Ouch, it seems the autocrop is a blocker to post-calculation as it needs the image data to decide how to crop... :(

from easy-thumbnails.

SmileyChris avatar SmileyChris commented on August 18, 2024

Thinking about it again, I'm pro putting the source dimensions in the cache models. Let's do it.

from easy-thumbnails.

alanjds avatar alanjds commented on August 18, 2024

Please considere this issue: http://bit.ly/x7mGse

Not storing the image dimensions makes the storage backend to spend effort trying to get if from the true data, which costs a lot more than wasting columns or hitting the database, if using a remote storage backend like Amazon S3.

I am not saying that its a problem of easy-thumbnails or of Django itself, just that this feature can fix it.

from easy-thumbnails.

SmileyChris avatar SmileyChris commented on August 18, 2024

I've already said it's a good idea - just haven't got around to implementing it. It's probably one of the last changes to the models before I reset the migrations (which have caused no end of pain for mysql users) and call easy-thumbnails "1.0".

Feel free to implement this (migrations, code, tests & docs) and fire me a pull request.

from easy-thumbnails.

SmileyChris avatar SmileyChris commented on August 18, 2024

Done!

from easy-thumbnails.

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.