{
"info": {
"author": "Gregory Taylor",
"author_email": "gtaylor@gc-taylor.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python"
],
"description": "django-athumb\n=============\n\n:Author: Greg Taylor\n:License: BSD\n\nStoring images and their thumbnails on S3 is a bit of a clumbsy endeavor with\nDjango. While this Django app may work with more typical storage backends, it\nis intended to accept image uploads, thumbnail them, and upload the original\nplus the thumbs to S3. You may then get to the thumbnails in your template\nby doing something like::\n\n
\n\nThis automatically assembles the remote S3 URL to retrieve the thumbnail from.\nNo error checking is done, and several assumptions are made for the sake of\nspeed.\n\nAdvantages of django-athumb\n---------------------------\n\nThe primary advantage of django-athumb is that, unlike sorl and others,\nthumbnails are generated at the time of user uploading the original image.\nInstead of generating thumbs on-demand, or needing a caching layer, we generate\npre-defined thumbnails at time of upload. This leads to a few big benefits:\n\n* We never check for the existence of a file, after the first save/upload. We\n assume it exists, skipping the need to hit caches or the disk. This makes\n us faster and more simple than some of the other alternatives.\n* Since we define every possible thumbnail in advance via models.py, we have\n a defined set of possible values. Thumbnails sizes can also be named anything,\n whether it be '60x60_cropped' or 'medium_nocrop'.\n\n\nDisadvantages of django-athumb\n------------------------------\n\nThis wouldn't be a fair assessment without some of these:\n\n* Some may prefer to define thumbnail sizes in templates. This is largely\n preference.\n* We only support simple scaling/cropping/centering as thumbnail operations.\n sorl and others are going to give you a whole lot more gadgets out of the box.\n\n\nLicense\n-------\n\nAll code is under a BSD-style license, see LICENSE for details.\n\nSource: http://github.com/duointeractive/django-athumb\n\nRequirements\n------------\n\n* python >= 2.7\n* django >= 1.6\n* boto >= 3.0\n* Pillow >= 2.5.0\n\nInstallation\n------------\n\nTo install run::\n\n pip install django-athumb\n\nor::\n\n easy_install django-athumb\n\nConfiguration\n-------------\n\nsettings.py\n^^^^^^^^^^^\n\nAdd to ``INSTALLED_APPS``::\n\n 'athumb'\n\nAdd to ``TEMPLATE_CONTEXT_PROCESSORS`` in ``settings.py``::\n\n 'django.core.context_processors.request'\n\nIf you want S3 storage as your default file back-end::\n\n # If you don't want this to be the global default, just make sure you\n # specify the S3BotoStorage_AllPublic backend on a per-field basis.\n DEFAULT_FILE_STORAGE = 'athumb.backends.s3boto.S3BotoStorage_AllPublic'\n\nThen setup some values used by the backend::\n\n AWS_ACCESS_KEY_ID = 'YourS3AccessKeyHere'\n AWS_SECRET_ACCESS_KEY = 'YourS3SecretAccessKeyHere'\n AWS_STORAGE_BUCKET_NAME = 'OneOfYourBuckets'\n\nIf you would like to use a vanity domain instead of s3.amazonaws.com, you\nfirst should configure it in amazon and then add this to settings::\n\n AWS_STORAGE_BUCKET_CNAME = 'static.yourdomain.com'\n\nIf you want a cache buster for your thumbnails (a string added to the end of\nthe image URL that causes browsers to re-fetch the image after changes), you\ncan set a value like this::\n\n MEDIA_CACHE_BUSTER = 'SomeValue'\n\nYou do not need to specify a cache buster.\n\nIf you aren't using the default S3 region, you can define it with the following\nsetting::\n\n AWS_REGION = 'us-east-1'\n\nUsing in models\n---------------\n\nAfter you have all of the above configured, you're ready to start using\nathumb in your models. Here is an example model with a thumbnailing field.\n\n::\n\n from django.db import models\n from athumb.fields import ImageWithThumbsField\n from athumb.backends.s3boto import S3BotoStorage_AllPublic\n\n # It is generally good to keep these stored in their own module, to allow\n # for other models.py modules to import the values. This assumes that more\n # than one model stores stuff in the same bucket.\n PUBLIC_MEDIA_BUCKET = S3BotoStorage_AllPublic(bucket='public-media')\n\n class YourModel(models.Model)\n image = ImageWithThumbsField(\n upload_to=\"store/product_images\",\n thumbs=(\n ('50x50_cropped', {'size': (50, 50), 'crop': True}),\n ('60x60', {'size': (60, 60)}),\n ('80x1000', {'size': (80, 1000)}),\n ('front_page', {'size': (120, 1000)}),\n ('medium', {'size': (161, 1000)}),\n ('large', {'size': (200, 1000)}),\n ),\n blank=True, null=True,\n storage=PUBLIC_MEDIA_BUCKET)\n\nA few things to note:\n\n* The tuples in `thumbs` are in the format of `(name, options)`. The value\n for `name` can be whatever string you'd like. Notice that you can make the\n names dimensions, or something entirely different.\n* The `storage` keyword is important, used for specifying the bucket for the\n field. If you don't specify `storage`, the default backend is used. As a\n shortcut, you could set `S3BotoStorage_AllPublic` as your default backend,\n and the `AWS_*` values would determine the default bucket.\n\nBackends\n^^^^^^^^\n\ndjango-athumb comes with a simplified s3boto backend, modified from those found\nin the django-storages project. For most cases, you'll want to use\n``athumb.backends.s3boto.S3BotoStorage_AllPublic``, as it does not use HTTPS, and\nis a good bit faster than ``S3BotoStorage`` because it makes some assumptions.\n\n.. note:: This module is primarily aimed at storing and serving images to/from\n S3. I have not tested it at all with the standard Django Filesystem backend,\n though it *should* work.\n\nTemplate Tags\n-------------\n\nWhen referring to media in HTML templates you can use custom template tags.\nThese tags can by accessed by loading the athumb template tag collection.\n\n {% load thumbnail %}\n\nIf you'd like to make the athumb tags global, you can add the following to\nyour master urls.py file:\n\n from django.template import add_to_builtins\n add_to_builtins('athumb.templatetags.thumbnail')\n\nSome backends (S3) support https URLs when the requesting page is secure.\nIn order for the https to be detected, the request must be placed in the\ntemplate context with the key ``'request'``. This can be done automatically by adding\n``'django.core.context_processors.request'`` to ``TEMPLATE_CONTEXT_PROCESSORS``\nin settings.py\n\nthumbnail\n^^^^^^^^^\n\nReturns the URL for the specified thumbnail size (as per the object's\nmodels.py Model class)::\n\n {% thumbnail some_obj.image '50x50_cropped' %}\n\nor, to save the value in a template context variable::\n\n {% thumbnail some_obj.image 'front_page' as 'some_var' %}\n\nAs long as you've got Django's request context processor in, the thumbnail tag\nwill detect when the current view is being served over SSL, and automatically\nconvert any http to https in the thumbnail URL. If you want to always force\nSSL for a thumbnail, add it as an argument like this::\n\n {% thumbnail some_obj.image '60x60' force_ssl=True %}\n\nTo put the thumbnail URL on the context instead of just rendering\nit, finish the tag with `as [context_var_name]`::\n\n {% thumbnail image '60x60' as 'thumb' %}\n
\n\n\nmanage.py commands\n------------------\n\nathumb_regen_field\n^^^^^^^^^^^^^^^^^^\n\n # ./manage.py athumb_regen_field \n\nRe-generates thumbnails for all instances of the given model, for the given\nfield.\n\n\nTo-Do\n-----\n\n* See the issue tracker for a list of outstanding things needing doing.\n\n\nChange Log\n----------\n\n2.4.1\n=====\n\n* Fixes to restore compatibility with migrations. (jneves)\n\n2.4\n===\n\n* Changes to add Django 1.7 compatibility.\n\n2.3\n===\n\n* Embed pial, eliminating the need to install it separately.\n\n2.2\n===\n\n* Added support for different S3 regions via the AWS_REGION setting.\n* Improved error handling.\n\n2.1\n===\n\n* Make MEDIA_CACHE_BUSTER optional.\n* Documented MEDIA_CACHE_BUSTER.\n\n2.0\n===\n\n* Complete re-work of the way thumbnails are specified in models.py.\n* Removal of the attribute-based image field size retrieval, since we no\n longer are just limited to dimensions.\n* Further misc. improvements.\n\n1.0\n===\n\n* Initial release.",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://github.com/gtaylor/django-athumb",
"keywords": null,
"license": "BSD License",
"maintainer": null,
"maintainer_email": null,
"name": "django-athumb",
"package_url": "https://pypi.org/project/django-athumb/",
"platform": "any",
"project_url": "https://pypi.org/project/django-athumb/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "http://github.com/gtaylor/django-athumb"
},
"release_url": "https://pypi.org/project/django-athumb/2.4.1/",
"requires_dist": null,
"requires_python": null,
"summary": "A simple, S3-backed thumbnailer field.",
"version": "2.4.1"
},
"last_serial": 1871672,
"releases": {
"1.0": [
{
"comment_text": "",
"digests": {
"md5": "9722a5b74fb7d4daa68fa4131056080c",
"sha256": "a8984a215281e7c90bf045f92cf3f1585375d2dbaafd20a4c2a592527f72cfc4"
},
"downloads": -1,
"filename": "django-athumb-1.0.tar.gz",
"has_sig": false,
"md5_digest": "9722a5b74fb7d4daa68fa4131056080c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13110,
"upload_time": "2010-09-10T22:03:48",
"url": "https://files.pythonhosted.org/packages/04/b0/0a7a77ea95f23fca64fa14b6af324a2f38155f63fa0565581b9afa2c506f/django-athumb-1.0.tar.gz"
}
],
"2.0": [
{
"comment_text": "",
"digests": {
"md5": "037f6bbef38d407d2899601a4ec356c5",
"sha256": "c26b8fb840d0cd5dce017186cff70be886749edf63e59435653beae43c67464c"
},
"downloads": -1,
"filename": "django-athumb-2.0.tar.gz",
"has_sig": false,
"md5_digest": "037f6bbef38d407d2899601a4ec356c5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16903,
"upload_time": "2011-01-24T15:58:06",
"url": "https://files.pythonhosted.org/packages/cf/e8/fb39a82308a63ae7943c0560c4fcc185450345a34dadc3381912b6c12c0c/django-athumb-2.0.tar.gz"
}
],
"2.4.1": [
{
"comment_text": "",
"digests": {
"md5": "aeb1f4f8778c6e9198fa7c9c8f172710",
"sha256": "ef31c9ffa162716ee2cd127ce8271d1652bf77b4a62538ba695505763ae28969"
},
"downloads": -1,
"filename": "django-athumb-2.4.1.tar.gz",
"has_sig": false,
"md5_digest": "aeb1f4f8778c6e9198fa7c9c8f172710",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 21536,
"upload_time": "2015-12-21T06:30:29",
"url": "https://files.pythonhosted.org/packages/89/e9/efc5b6f5b497e3633d2f7044b428ca9a7f9babb1009271055dfe58be91eb/django-athumb-2.4.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "aeb1f4f8778c6e9198fa7c9c8f172710",
"sha256": "ef31c9ffa162716ee2cd127ce8271d1652bf77b4a62538ba695505763ae28969"
},
"downloads": -1,
"filename": "django-athumb-2.4.1.tar.gz",
"has_sig": false,
"md5_digest": "aeb1f4f8778c6e9198fa7c9c8f172710",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 21536,
"upload_time": "2015-12-21T06:30:29",
"url": "https://files.pythonhosted.org/packages/89/e9/efc5b6f5b497e3633d2f7044b428ca9a7f9babb1009271055dfe58be91eb/django-athumb-2.4.1.tar.gz"
}
]
}