Skip to main content

AJAX driven gallery field for django

Project description

Quick start

1. Svn checkout

svn co http://django-imaging.googlecode.com/svn/trunk/ django-imaging

2. Put "imaging" folder into your python path (easiest way: put it in your django project directory)

3. Put the contents of the media folder in your project's MEDIA_ROOT

Make sure the imaging_photos folder has 777 permissions

4. Add "imaging" to your INSTALLED_APPS tuple in settings.py

5. Include imaging in your urls.py

urlpatterns = patterns('',
(...)
(r'^imaging/', include('imaging.urls')),
(...)
)

Or include('myappname.imaging.urls')

6. Add ImagingField? to desired model

from imaging.fields import ImagingField

class Somemodel(models.Model):
photos = ImagingField()

7. Optionally add a related model field for easy image fetching

from django.contrib.contenttypes import generic
from imaging.fields import ImagingField
from imaging.models import Image

class Somemodel(models.Model):
photos = ImagingField()
photos_set = generic.GenericRelation(Image)

8. Optionally add a custom imaging config to your settings.py

IMAGING_SETTINGS = {
'image_sizes' : [
{
'name':'my_custom_thumb',
'width': 190,
'height': 150,
'aspect': False,
'suffix': '_cus_thb'
},
],
'image_dir' : 'funny_photos',
}

Above example will make django-imaging create only one thumbnail size, without forcing the aspect ratio giving the thumbnail files suffix _cus_thb. The images uploaded will be stored inside MEDIA_ROOT/funny_photos. The image_sizes list can contain an unlimited thumbnail dictionaries. You can easily access a thumbnail of an image model by an auto-created method:

>>> image = Image.objects.get(pk=1)
>>> image.get_my_custom_thumb_url()

So basically the method name is built: get_+thumbnail_name+url()

9. Syncdb to create proper imaging tables.

Have fun :)
Limitations

1. Currently only one ImagingField? per model.
2. Drag'n'drop doesn't work properly in Opera (jquery.ui.sortable related problem)
3. No orphaned images management
4. ManyToMany? relation with an Image not supported
5. Need to add a GenericRelation? field manually, I can't figoure out how to autoadd it
6. Exeptions not handled too well

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-imaging-0.9.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

django_imaging-0.9-py2.7.egg (2.5 kB view details)

Uploaded Egg

File details

Details for the file django-imaging-0.9.tar.gz.

File metadata

  • Download URL: django-imaging-0.9.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-imaging-0.9.tar.gz
Algorithm Hash digest
SHA256 18734f6a547af8e0c3f524afc4172a4ceaae01fc43fd96069f581604aca04ffd
MD5 e2090330a9496c0a732c1816ee7f56a5
BLAKE2b-256 fe1b6717e0199de724abb9ca7ef8dff46d34eee9cdeddf84e91984813803c21c

See more details on using hashes here.

File details

Details for the file django_imaging-0.9-py2.7.egg.

File metadata

File hashes

Hashes for django_imaging-0.9-py2.7.egg
Algorithm Hash digest
SHA256 d8ace582f1990313da918060134eba93455ff6a727853904de8d9f0af0b40566
MD5 d846dcbf9073e056cb732d018a17ac39
BLAKE2b-256 1fd1209348443bc930ceae2a8c67fc7de67aa7ef3773b58dc54c97fab0cf7c04

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