Code Monkey home page Code Monkey logo

Comments (7)

SmileyChris avatar SmileyChris commented on July 21, 2024

Definitely sounds wrong... would like some more detail so I can figure out exactly where the problem lies.

Could you please provide the following info:

  • the exact output you are getting for one incorrect thumbnail
  • the raw value of the stored field

from easy-thumbnails.

jasonchrista avatar jasonchrista commented on July 21, 2024

in files.py Thumbnailer::get_thumbnail_name ends with the line:
return os.path.join(basedir, path, subdir, filename)
On windows this will join with the '' character. I think it should be:
return os.path.join(basedir, path, subdir, filename).replace('', '/')

The raw values are all stored with the correct forward slash (/).

from easy-thumbnails.

SmileyChris avatar SmileyChris commented on July 21, 2024

yep, seems right. Simpler version would just be '/'.join(bits) :)

from easy-thumbnails.

jasonchrista avatar jasonchrista commented on July 21, 2024

os.path.join is smart enough to know what to do with empty directories though. '/'.join is too naive and you can get things like basedir//subdir/filename instead of basedir/subdir/filename.

from easy-thumbnails.

SmileyChris avatar SmileyChris commented on July 21, 2024

Right, in fact looking closer, I'm not actually convinced that we need to do this.

ThumbnailFile uses the same logic as a FieldFile for url generation, which involves using the storage's url method. This method does the replacement.

How are you generating the url?

from easy-thumbnails.

jasonchrista avatar jasonchrista commented on July 21, 2024

You are correct I was doing it the sorl-thumbnail way, which was wrong.

{% thumbnail model.image 50x50 as image %}

Then I was using {{image}} instead of {{image.url}}

from easy-thumbnails.

SmileyChris avatar SmileyChris commented on July 21, 2024

Yeah, I upgraded a site recently and was bit with that. Glad we got to the bottom of it!

If you want to write some sorl-thumbnail upgrade docs, that'd be cool ;)

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.