New in 0.4.0:
Photofile can detect screen resolution using a decorator, like so:
from django.http import HttpResponseRedirect, HttpResponse
from photofile.decorators import provide_screen_info
@provide_screen_info
def index(request):
return HttpResponse("%sx%s" % (request.session.get('screen_width'), request.session.get('screen_height')))
You also need to add the photofile.urls:
from django.conf.urls.defaults import patterns, include, url
import photofile
urlpatterns = patterns('',
url(r'^default.html$', 'testme.views.index'),
)
urlpatterns += photofile.urls.urlpatterns;
This also makes it possible for photofile to automatically generate maximized thumbnails depending on the screen resolution:
{% generate_thumbnail imagefile max %}
using the max option for resolution.
0 comments:
Post a Comment
Be nice. Always. Except.