{ "info": { "author": "Mikhail Andreev", "author_email": "x11org@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-nginx-image\n========================\n\n.. image:: http://adw0rd.com/media/uploads/django_nginx_image.jpg\n :align: right\n\n\nResizing and cropping images via Nginx, as well as caching the result\n\n pip install django-nginx-image\n \n.. image:: https://pypip.in/d/django-nginx-image/badge.png\n :target: http://pypi.python.org/pypi/django-nginx-image\n\n\nFeatures:\n------------------------\n\n* High-performance resize and crop via Nginx\n* Transparent caching an images\n* Template tag ``thumbnail`` for building correct URL for Nginx\n* The Django command for convert unsupported images formats (example, BMP) to JPG\n\nFor more details see:\n------------------------\n\n* http://github.com/adw0rd/django-nginx-image - the GitHub repository\n* http://pypi.python.org/pypi/django-nginx-image - the PyPI page\n* http://adw0rd.com/2012/django-nginx-image/ - article about this package on Russian\n* http://adw0rd.com/2012/django-nginx-image/en/ - article about this package on English\n\n\nSettings:\n------------------------\n\nAdd to ``settings.py``::\n\n INSTALLED_APPS = (\n 'nginx_image',\n )\n\nNow, add two sections called ``server``:\n\n1. The cache server ``www.example.org``, which will connect to the second server and receive changed image and save the result to the cache.\n2. The image server ``image.example.org``, which can to resize and to crop a images.\n\n.. image:: http://adw0rd.com/media/uploads/django-nginx-image.jpg\n\nA sample of configuration file for your project::\n\n http {\n\n proxy_cache_path /nginx/cache levels=1:2 keys_zone=:10m max_size=1G;\n \n server {\n listen 80;\n server_name www.example.org;\n \n location ~* ^/(resize|crop)/ {\n proxy_pass http://image.example.org$request_uri;\n proxy_cache ;\n proxy_cache_key \"$host$document_uri\";\n proxy_cache_valid 200 1d;\n proxy_cache_valid any 1m;\n proxy_cache_use_stale error timeout invalid_header updating;\n }\n }\n \n server {\n listen 80;\n server_name image.example.org;\n \n location ~* ^/resize/([\\d\\-]+)/([\\d\\-]+)/(.+)$ {\n alias /$3;\n image_filter resize $1 $2;\n image_filter_buffer 2M;\n error_page 415 = /empty;\n }\n \n location ~* ^/crop/([\\d\\-]+)/([\\d\\-]+)/(.+)$ {\n alias /$3;\n image_filter crop $1 $2;\n image_filter_buffer 2M;\n error_page 415 = /empty;\n }\n \n location = /empty {\n empty_gif;\n }\n }\n }\n\nWhere, ``STORAGE_ROOT`` is the path to directory with web-assests. For example I have in my ``settings.py``::\n\n STORAGE_ROOT = \"/storage/kinsburg_tv\"\n MEDIA_ROOT = os.path.join(STORAGE_ROOT, \"media\")\n STATIC_ROOT = os.path.join(STORAGE_ROOT, \"static\")\n\nAnd \"CACHE_NAME\" is the arbitrarily name, example: \"my_project_cache\".\n\nUsage:\n------------------------\n\nIn the templates can be used as follows::\n\n {% load nginx_image %}\n \n Proportionally resize a image, based on the width and the height:\n {% thumbnail user.profile.avatar 130 130 %}\n\n Proportionally resize a image, based on the width:\n {% thumbnail user.profile.avatar 130 '-' %}\n {% thumbnail user.profile.avatar 130 0 %}\n {% thumbnail user.profile.avatar 130 %}\n\n Proportionally resize a image, based on the height:\n {% thumbnail user.profile.avatar '-' 130 %}\n {% thumbnail user.profile.avatar 0 130 %}\n\n Crop a image:\n {% thumbnail user.profile.avatar 130 130 crop=1 %}\n {% thumbnail user.profile.avatar 130 0 crop=1 %}\n {% thumbnail user.profile.avatar 0 130 crop=1 %}\n\n\nConvert:\n-------------\n\nUnfortunaly, **ngx_http_image_filter_module** only supports JPEG, GIF and PNG, so you have to convert BMP to JPG::\n\n ./manage.py nginx_image_converter -i /storage/project/media -o /storage/project/newmedia\n\nAvailable options::\n\n -i SOURCE, --source=SOURCE\n Source directory with pictures\n -o DESTINATION, --destination=DESTINATION\n Destination directory for save the pictures\n -q QUALITY, --quality=QUALITY\n Percentage of quality for images in JPG\n -e, --change-extension\n Change extension to \"jpg\"", "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/adw0rd/django-nginx-image", "keywords": "django,nginx,image,resize,crop,cache", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-nginx-image", "package_url": "https://pypi.org/project/django-nginx-image/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-nginx-image/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/adw0rd/django-nginx-image" }, "release_url": "https://pypi.org/project/django-nginx-image/0.3.2/", "requires_dist": null, "requires_python": null, "summary": "Resizing and cropping images via Nginx, and cache the result", "version": "0.3.2" }, "last_serial": 923328, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "0f11757bd574dc57e4a867c44d48adbe", "sha256": "18e7deaf53955d901a4356d99f255a4c3c4f2f09c0e6c3c05dc3a4be42a0cd89" }, "downloads": -1, "filename": "django-nginx-image-0.1.tar.gz", "has_sig": false, "md5_digest": "0f11757bd574dc57e4a867c44d48adbe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2173, "upload_time": "2012-10-03T14:55:26", "url": "https://files.pythonhosted.org/packages/b9/96/2b1d83625d75fd31c871f796ae2d705cbc42a31762f5b17351f476a421de/django-nginx-image-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "818d02b4f13014b801f0029636fb2b4c", "sha256": "dee4595917220ea60211d5884aefac5abc1c4f79865ee1f2ed51e9dbafbf6dfa" }, "downloads": -1, "filename": "django-nginx-image-0.2.tar.gz", "has_sig": false, "md5_digest": "818d02b4f13014b801f0029636fb2b4c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3199, "upload_time": "2012-10-27T22:49:14", "url": "https://files.pythonhosted.org/packages/f5/c0/be73b26b968726496c8dab0bcca7a3450676d2bf5d1b68feefe683b92e0f/django-nginx-image-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "b6518120121c6bb0bdddb9a0c0b188b8", "sha256": "f95184794b566acaf82ead1e8366234e6077c61b2f9419c662b861a0ec478b0c" }, "downloads": -1, "filename": "django-nginx-image-0.3.tar.gz", "has_sig": false, "md5_digest": "b6518120121c6bb0bdddb9a0c0b188b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4429, "upload_time": "2013-04-27T13:36:15", "url": "https://files.pythonhosted.org/packages/90/15/62d8cacdea37d1f9c7d69561f8c48d3c8dc1c9b24f388cad2d6894e86b61/django-nginx-image-0.3.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "f78252a011a677b94d6a061065e40d6e", "sha256": "3bd10922176effaa28eff666a459add9b3a7355e390748411580f2d43c271908" }, "downloads": -1, "filename": "django-nginx-image-0.3.2.tar.gz", "has_sig": false, "md5_digest": "f78252a011a677b94d6a061065e40d6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4466, "upload_time": "2013-11-19T06:34:30", "url": "https://files.pythonhosted.org/packages/4e/ba/22f745b1469888b554520e298bbcb8128ce646b92f5e3c38873810289937/django-nginx-image-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f78252a011a677b94d6a061065e40d6e", "sha256": "3bd10922176effaa28eff666a459add9b3a7355e390748411580f2d43c271908" }, "downloads": -1, "filename": "django-nginx-image-0.3.2.tar.gz", "has_sig": false, "md5_digest": "f78252a011a677b94d6a061065e40d6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4466, "upload_time": "2013-11-19T06:34:30", "url": "https://files.pythonhosted.org/packages/4e/ba/22f745b1469888b554520e298bbcb8128ce646b92f5e3c38873810289937/django-nginx-image-0.3.2.tar.gz" } ] }