ricobl / django-thumbor Goto Github PK
View Code? Open in Web Editor NEWA django app with templatetags for resizing images with thumbor
Home Page: https://django-thumbor.readthedocs.org/en/latest/
License: MIT License
A django app with templatetags for resizing images with thumbor
Home Page: https://django-thumbor.readthedocs.org/en/latest/
License: MIT License
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
Hi, thanks for maintaining this package.
Do you plan to update the package on PyPI?
Thanks again.
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
@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?
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.
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}}">
Why http:// prefix is removed when using generate_url? Are there any settings to add http prefix?
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
I wanted to do a pull request for adding static_url support, but have no rights..
how can I do ?
fatal: unable to access 'https://github.com/ricobl/django-thumbor.git/': The requested URL returned error: 403
Hi,
I'm trying using the option filter fill(), but only image is resized.
img src="{% thumbor_url url filters='format(png):fill(blue)' width=170 height=170 %}"
I would like the same action of this url.
http://localhost:8888/unsafe/fit-in/170x170/filters:fill(blue)/www.reefbrasilaquarios.com.br/images/pinca2.jpg
thanks
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.