Code Monkey home page Code Monkey logo

django-thumbor's People

Contributors

avelino avatar dependabot[bot] avatar hakanw avatar henriquechehad avatar nuschk avatar ricobl avatar starou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

django-thumbor's Issues

How to apply filters in template tag?

Hi, I can use generate_url from shell and view correctly

>>> from django_thumbor import generate_url
>>> resized = generate_url("/some/image.jpg", width=300, filters=["watermark(/images/watermark.png,-10,-10,20)"])
>>> resized
'http://example.com/LZe05kULGfyrG6RSeiXXpj3es3I=/300x0/filters:watermark(/images/watermark.png,-10,-10,20)/some/image.jpg'

but I can't find the way to use the filters for in template with template tag

Templatetag thumbor_url accept image instance

When access model.image.url to get image URL string and pass it to thumbor_url templatetag, if the image field doesn't have an associated file, returns the error:

ValueError: The 'image' attribute has no file associated with it.

I added a support with this validation for directly image param in thumbor_url templatetag in this PR:
#11

Thumbor 7

@ricobl I'm compiling an awesome thumbor page and would like to feature this extension as thumbor 7 compliant. Do you know if that's the case?

Add thumbnail aliases

I think it would be great to have thumbnail aliases in django-thumbor. An alias is basically a string you would pass to generate_url() instead of the usual parameters. This facilitates reuse of thumbor settings and thus positively affecting thumbor overall performance.

Another use case is for people (like in my case) migrating over from easy-thumbnails, where this is used in all cases, and who already have defined their thumbnails application-wide.

Alias definitions would need to go into your django settings file and could look something like this:

THUMBOR_ALIASES = {
    'thumb_64x64': dict(width=64, height=64, filters=["quality(95)"]),
    'avatar': dict(width=600, height=360, filters=["quality(70)"]),
}

Then using it could be made using the generate_url() function as well:

generate_url(my_img.url, alias="avatar")

And very similarly in templates:

{% thumbor_url my_img.url alias="avatar" %}

I'm happy to create a PR if people think this idea is worthwile.

Add assignment template tag

In some situations it's useful to have both, a normal template tag as well as an assignment tag. It leads to less repetition and easier to read code. Also, you'll be able to pass the thumb url down to a partial html template.

{% assign_thumbor_url '/media/test.jpn' alias="thumb" as thumb_url%}
<img src="{{thumb_url}}">

'NoneType' object has no attribute 'startswith' if no images

Hi, django thumbor raises an exception if there is no image given. here is the traceback
AttributeError: 'NoneType' object has no attribute 'startswith'
if url.startswith(settings.MEDIA_URL):
he is testing directly the url. Would make more sense if he tested first if there is an url

Can I use this with public and private remote storage on S3?

We use django-storages to access media from S3. Some objects are private, requiring a signed URL to access.

Looking at django-thumbor, it seems that it does a pretty naive concatenation of THUMBOR_MEDIA_URL (an absolute version of MEDIA_URL) and the requested object.

I think we could construct a value for THUMBOR_MEDIA_URL that should work for public objects, but won't work for private objects.

I notice that there's https://github.com/thumbor-community/aws which supports loading private objects from S3.

Does django-thumbor have any support (or plans to support) loading public and private images from S3, either via the AWS loader above or otherwise?

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.