Comments (7)
Hi @pythdasch, does it make sense to add this check?
What do you expect to happen when you pass None
as a URL?
Your code should probably check this before calling the function or using the templatetag.
from django-thumbor.
I'm closing the issue ok? Feel free to comment.
from django-thumbor.
I agree with you but why not adding some exceptions ?
Thanks for the reply :)
from django-thumbor.
IMHO it's an unnecessary complexity, it's something that can be done outside the lib.
from django-thumbor.
By the way, I also have some changes that I made to fix the fact that sometimes we serve the media locally and to make it work in production I had to add :
def _prepend_media_url(url):
if url.startswith(settings.MEDIA_URL):
url = _remove_prefix(url, settings.MEDIA_URL)
url.lstrip('/')
return '%s/%s' % (conf.THUMBOR_MEDIA_URL, url)
return url
def _prepend_static_url(url):
if url.startswith(settings.STATIC_URL):
url = _remove_prefix(url, settings.STATIC_URL)
url.lstrip('/')
return '%s/%s' % (conf.THUMBOR_STATIC_URL, url)
return url
def generate_url(image_url, **kwargs):
# if settings.DEBUG:
# if not "http" in image_url:
# dt = datetime.now()
# image_url = "http://lorempixel.com/g/1000/1000/?%s"%(dt.microsecond)
image_url = _prepend_media_url(image_url)
image_url = _prepend_static_url(image_url)
image_url = _remove_schema(image_url)
kwargs = dict(conf.THUMBOR_ARGUMENTS, **kwargs)
thumbor_server = kwargs.pop(
'thumbor_server', conf.THUMBOR_SERVER).rstrip('/')
encrypted_url = crypto.generate(image_url=image_url, **kwargs).strip('/')
return '%s/%s' % (thumbor_server, encrypted_url)
from django-thumbor.
Looks good @pythdasch, it could help others.
Would like to send a pull request with this code and tests?
from django-thumbor.
yes i could!
Le 17 mai 2016 19:31, "Enrico Batista da Luz" [email protected] a
Γ©crit :
Looks good @pythdasch https://github.com/pythdasch, it could help
others.Would like to send a pull request with this code and tests?
β
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#7 (comment)
from django-thumbor.
Related Issues (11)
- Templatetag thumbor_url accept image instance HOT 1
- Add thumbnail aliases HOT 5
- Add assignment template tag HOT 3
- Can I use this with public and private remote storage on S3? HOT 3
- http:// prefix on generate_url is omitted HOT 1
- Thumbor 7 HOT 3
- Do you plan to update the package on PyPI? HOT 2
- How to apply filters in template tag? HOT 7
- Filter fill() HOT 1
- Can't push to repository HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-thumbor.