Skip to main content

A simple Django app to create deep zoom tiled images.

Project description

Django-deepzoom is a drop-in Django app for the creation and use of Deep Zoom tiled images. It handily integrates Daniel Gasienica’s and Kapil Thangavelu’s deepzoom.py image generator, Microsoft’s SeaDragon deep zoom viewer, and Sean Rice’s JavaScript touch events into a set of model classes and template tags which programmatically generate tiled images and all JavaScript necessary for their instantiation into templates.

Detailed documentation is available on ReadTheDocs.

Run tests

After django-deepzoom has been installed, you may want to sanity check it by running tests, like this:

python manage.py test deepzoom --settings=deepzoom.test.test_settings

Quick start

1.) Install “django-deepzoom” like this:

pip install -U django-deepzoom

or, like this:

wget https://pypi.python.org/packages/source/d/django-deepzoom/django-deepzoom-0.1.tar.gz
tar -xvf django-deepzoom-0.1.tar.gz
cd django-deepzoom-0.1
python setup.py install

2.) Add “deepzoom” to your INSTALLED_APPS setting like this:

(in settings.py)

INSTALLED_APPS = (
    ...
    'deepzoom',
    ...
)

3.) Sub-class the ‘UploadedImage’ model class as your own (image-based) class, something like this:

(in models.py)

from deepzoom.models import DeepZoom, UploadedImage

class MyImage(UploadedImage):
  '''
  Overrides UploadedImage base class.
  '''
  pass

4.) Run python manage.py syncdb to create the django-deepzoom models.

5.) Add an appropriate URL to your Urlconf, something like this:

(in urls.py)

from deepzoom.views import deepzoom_view

urlpatterns = patterns('',
    ...
    url(r'^deepzoom/(?P<passed_slug>\b[a-z0-9\-]+\b)',
        deepzoom_view,
        name="v_deepzoom"),
    ...
)

6.) Write a view that queries for a specific DeepZoom object and passes it to a template, something like this:

(in views.py)

from deepzoom.models import DeepZoom

def deepzoom_view(request, passed_slug=None):
  try:
      _deepzoom_obj = DeepZoom.objects.get(slug=passed_slug)
  except DeepZoom.DoesNotExist:
      raise Http404
  return render_to_response('deepzoom.html',
                            {'deepzoom_obj': _deepzoom_obj},
                            context_instance=RequestContext(request))

7.) In your template, create an empty div with a unique ID. Load the deepzoom tags and pass the deepzoom object and deepzoom div ID to the template tag inside a <script> block in the body like this:

(in e.g. deepzoom.html)

{% extends "base.html" %}

{% load deepzoom_tags %}

<div id="deepzoom_div"></div>

<script src="{{ STATIC_URL }}js/vendor/seadragon-min.js"></script>

<script>{% deepzoom_js deepzoom_obj "deepzoom_div" %}</script>

8.) Run python manage.py collectstatic to collect your static files into STATIC_ROOT.

9.) Start the development server and visit http://127.0.0.1:8000/admin/ to upload an image to the associated model (you’ll need the Admin app enabled). Be sure to check the Generate deep zoom? checkbox for that image before saving it.

10.) Navigate to the page containing the deep zoom image and either click/touch it or click/touch the overlaid controls to zoom into and out of the tiled image:

**Behold!**

.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-deepzoom-0.1.tar.gz (304.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django-deepzoom-0.1.linux-x86_64.exe (366.9 kB view details)

Uploaded Source

File details

Details for the file django-deepzoom-0.1.tar.gz.

File metadata

  • Download URL: django-deepzoom-0.1.tar.gz
  • Upload date:
  • Size: 304.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-deepzoom-0.1.tar.gz
Algorithm Hash digest
SHA256 c8feb82e3cb10091e8b9ff80ab8c497aa70ab05443b78d85fb9f7a7dc917137b
MD5 640eab4bb8e3ef87ea7dfa4b2090d969
BLAKE2b-256 b9853bd129b77e7c8228ec0d227b20d273b727c46ce6174e3ccc2284686284d8

See more details on using hashes here.

File details

Details for the file django-deepzoom-0.1.linux-x86_64.exe.

File metadata

File hashes

Hashes for django-deepzoom-0.1.linux-x86_64.exe
Algorithm Hash digest
SHA256 5c497b38cab4e543b57b49571d9ed75c2ab2de6f481f50c97ad0dea6072deb51
MD5 a836a83bf26542c1359dd3a06ff18c43
BLAKE2b-256 296daed7e554dd73a66a197f189c3503ca2b314088ded9d63423923b00dcc67c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page