معرفی شرکت ها


django-croppy-0.1.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Django model field to store custom image crops
ویژگی مقدار
سیستم عامل -
نام فایل django-croppy-0.1.0
نام django-croppy
نسخه کتابخانه 0.1.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Alen Mujezinovic
ایمیل نویسنده alen@caffeinehit.com
آدرس صفحه اصلی https://github.com/caffeinehit/django-croppy
آدرس اینترنتی https://pypi.org/project/django-croppy/
مجوز Copyright (c) 2012, Caffeinehit Ltd. Copyright (c) 2012, Alen Mujezinovic <alen@caffeinehit.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
django-croppy |image0| ====================== ``django-croppy`` enables creating custom crops of images by specifying a name, coordinates, width and height of the crop. ``django-croppy`` provides a custom model field responsible for creating and deleting crops. Crops are stored as serialized JSON data on the same model as the image field via `django-jsonfield <http://pypi.python.org/pypi/django-jsonfield/>`_. ``django-croppy`` is useful if you want to manually curate the crop size and location instead of relying on generic cropping like `django-imagekit <http://pypi.python.org/pypi/django-imagekit/>`_ provides. ``django-croppy`` makes use of image processors provided by ``django-imagekit``. Usage ----- First, create your model with a crop field. You can specify a custom location where to save crops to with the ``upload_to`` parameter: :: from django.db import models from croppy.fields import CropField def upload_to(instance, filename, crop_name): """ Default function to specify a location to save crops to. :param instance: The model instance this crop field belongs to. :param filename: The image's filename this crop field operates on. :param crop_name: The crop name used when :attr:`CropFieldDescriptor.crop` was called. """ filename, ext = os.path.splitext(os.path.split(filename)[-1]) return os.path.join('crops', u'%s-%s%s' % (filename, crop_name, ext)) class Image(models.Model): image = models.ImageField() crops = CropField('image', upload_to = upload_to) The created ``crops`` field allows you to create, delete and inspect crops. :: $ git clone git@github.com:caffeinehit/django-croppy.git $ cd django-croppy $ python manage.py syncdb ... $ python manage.py shell ... >>> from tests.app import tests >>> image = tests.get_image('test.tiff') >>> image <Image: Image object> >>> image.image <ImageFieldFile: images/test.tiff> >>> image.image.path u'/home/alen/projects/django-croppy/tests/test-media/images/test.tiff' >>> # Inspect the crop data >>> image.crops.data {} >>> # Create a new crop called 'rect' at position 0/0 >>> # with a width of 100px and a height of 50px >>> image.crops.create('rect', (0, 0, 100, 50)) >>> # Inspect the crop data >>> image.crops.data {'rect': {'y': 0, 'width': 100, 'height': 50, 'filename': 'crops/test-rect.tiff', 'x': 0}} >>> # Inspect the crop >>> image.crops.rect.name 'crops/test-rect.tiff' >>> image.crops.rect.path u'/home/alen/projects/django-croppy/tests/test-media/crops/test-rect.tiff' >>> image.crops.rect.url '/test-media/crops/test-rect.tiff' >>> # Save the data to database >>> image.save() >>> # Delete the crop >>> image.crops.delete('rect') >>> image.crops.data {} .. |image0| image:: https://api.travis-ci.org/caffeinehit/django-croppy.png


نحوه نصب


نصب پکیج whl django-croppy-0.1.0:

    pip install django-croppy-0.1.0.whl


نصب پکیج tar.gz django-croppy-0.1.0:

    pip install django-croppy-0.1.0.tar.gz