Unverified Commit fd94bb19 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

utils/thumbnails: document thumbnail url usage

parent f8f15341
...@@ -31,6 +31,9 @@ def thumbnail(path, size, fit=True): ...@@ -31,6 +31,9 @@ def thumbnail(path, size, fit=True):
os.path.getmtime(full_path) > os.path.getmtime(full_thumbpath)): os.path.getmtime(full_path) > os.path.getmtime(full_thumbpath)):
pathuri = urlquote(path, safe=['']) pathuri = urlquote(path, safe=[''])
thumburi = urlquote(thumbpath, safe=['']) thumburi = urlquote(thumbpath, safe=[''])
# We provide a URL instead of calling it as a function, so that using
# it means kicking off a new GET request. If we would generate all
# thumbnails inline, loading an album overview would have high latency.
return reverse('generate-thumbnail', return reverse('generate-thumbnail',
args=[size_fit, pathuri, thumburi]) args=[size_fit, pathuri, thumburi])
...@@ -41,4 +44,7 @@ def thumbnail(path, size, fit=True): ...@@ -41,4 +44,7 @@ def thumbnail(path, size, fit=True):
return settings.MEDIA_URL + thumbpath return settings.MEDIA_URL + thumbpath
# Otherwise simply place it in media/thumbnails. # Otherwise simply place it in media/thumbnails.
# We provide a URL instead of calling it as a function, so that using
# it means kicking off a new GET request. If we would generate all
# thumbnails inline, loading an album overview would have high latency.
return reverse('private-thumbnails', args=[size_fit, path]) return reverse('private-thumbnails', args=[size_fit, path])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment