wagtail-sb-imageserializer


Namewagtail-sb-imageserializer JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer
SummarySocial Networks settings for wagtail sites.
upload_time2023-06-26 02:24:08
maintainer
docs_urlNone
authorSoftButterfly Development Team
requires_python>=3.8.1,<4.0.0
licenseMIT
keywords softbutterfly django migrations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Community-Project](https://gitlab.com/softbutterfly/open-source/open-source-office/-/raw/master/banners/softbutterfly-open-source--banner--community-project.png)

![PyPI - Supported versions](https://img.shields.io/pypi/pyversions/wagtail-sb-imageserializer)
![PyPI - Package version](https://img.shields.io/pypi/v/wagtail-sb-imageserializer)
![PyPI - Downloads](https://img.shields.io/pypi/dm/wagtail-sb-imageserializer)
![PyPI - MIT License](https://img.shields.io/pypi/l/wagtail-sb-imageserializer)

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/329484ea99434c708f5c8dbd611f3d35)](https://app.codacy.com/gl/softbutterfly/wagtail-sb-imageserializer/dashboard?utm_source=gl&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![Codacy Coverage Badge](https://app.codacy.com/project/badge/Coverage/900411c7b5e443f89f85c7978f7504e5)](https://app.codacy.com/gl/softbutterfly/wagtail-sb-imageserializer/dashboard?utm_source=gl&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)

# Wagtail Image Serializer

Wagtail package to render images with rendition in a single API Field.

## Requirements

- Python 3.8.1 or higher
- Wagtail 3.0 or higher
- Django 3.2 or higher
- Django Rest Framework 3.13 or higher

## Install

```bash
pip install wagtail-sb-imageserializer
```

## Usage

Add `wagtail.api.v2`, `rest_framework` and `wagtail_sb_imageserializer` to your `INSTALLED_APPS` settings

```
INSTALLED_APPS = [
  # ...
  "wagtail.api.v2",
  "rest_framework",
  "wagtail_sb_imageserializer",
  # ...
]
```

In your model specify the `ImageSerializerField` as serializer for the `APIField` related to the image field and add the `renditions` parameter with the renditions you want to render.

```python
from wagtail.models import Page
from wagtail.api import APIField
from wagtail_sb_imageserializer.fields import ImageSerializerField

class SamplePage(Page):
    image = ImageSerializerField()

    api_fields = [
        APIField(
          "image",
          serializer=ImageSerializerField(
              renditions={
                  "lazy": "fill-50x50",
                  "mobile": "fill-128x128",
                  "tablet": "fill-256x256",
                  "desktop": "fill-512x512",
              }
          ),
        ),
    ]
```

When yo require your page from the API, the image filed will looks like this

```json
{
    "id": 1234567890,
    "meta": {
        "type": "wagtailimages.Image",
        "title": "Image title",
        "alt": "Image alt text"
    },
    "original": {
        "width": 123456788890,
        "height": 123456788890,
        "download_url": "https://your-cdn-domain/path/to/original_images/image_name.png"
    },
    "renditions": {
        "lazy": {
            "width": 50,
            "height": 50,
            "download_url": "https://your-cdn-domain/path/to/reditions/image_name.fill-50x50.png"
        },
        "mobile": {
            "width": 128,
            "height": 128,
            "download_url": "https://your-cdn-domain/path/to/reditions/image_name.fill-128x128.png"
        },
        "tablet": {
            "width": 256,
            "height": 256,
            "download_url": "https://your-cdn-domain/path/to/reditions/image_name.fill-256x256.png"
        },
        "desktop": {
            "width": 512,
            "height": 512,
            "download_url": "https://your-cdn-domain/path/to/reditions/image_name.fill-512x512.png"
        }
    }
},
```

## Docs

- [Ejemplos](https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/wikis)
- [Wiki](https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/wikis)

## Changelog

All changes to versions of this library are listed in the [change history](CHANGELOG.md).

## Development

Check out our [contribution guide](CONTRIBUTING.md).

## Contributors

See the list of contributors [here](https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/graphs/develop).

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer",
    "name": "wagtail-sb-imageserializer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0.0",
    "maintainer_email": "",
    "keywords": "Softbutterfly,Django,Migrations",
    "author": "SoftButterfly Development Team",
    "author_email": "dev@softbutterfly.io",
    "download_url": "https://files.pythonhosted.org/packages/a0/d4/b98ad1e7158b46e91f7000a289060598e89661c72e2e24dc4da6030b6119/wagtail_sb_imageserializer-0.4.0.tar.gz",
    "platform": null,
    "description": "![Community-Project](https://gitlab.com/softbutterfly/open-source/open-source-office/-/raw/master/banners/softbutterfly-open-source--banner--community-project.png)\n\n![PyPI - Supported versions](https://img.shields.io/pypi/pyversions/wagtail-sb-imageserializer)\n![PyPI - Package version](https://img.shields.io/pypi/v/wagtail-sb-imageserializer)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/wagtail-sb-imageserializer)\n![PyPI - MIT License](https://img.shields.io/pypi/l/wagtail-sb-imageserializer)\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/329484ea99434c708f5c8dbd611f3d35)](https://app.codacy.com/gl/softbutterfly/wagtail-sb-imageserializer/dashboard?utm_source=gl&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)\n[![Codacy Coverage Badge](https://app.codacy.com/project/badge/Coverage/900411c7b5e443f89f85c7978f7504e5)](https://app.codacy.com/gl/softbutterfly/wagtail-sb-imageserializer/dashboard?utm_source=gl&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)\n\n# Wagtail Image Serializer\n\nWagtail package to render images with rendition in a single API Field.\n\n## Requirements\n\n- Python 3.8.1 or higher\n- Wagtail 3.0 or higher\n- Django 3.2 or higher\n- Django Rest Framework 3.13 or higher\n\n## Install\n\n```bash\npip install wagtail-sb-imageserializer\n```\n\n## Usage\n\nAdd `wagtail.api.v2`, `rest_framework` and `wagtail_sb_imageserializer` to your `INSTALLED_APPS` settings\n\n```\nINSTALLED_APPS = [\n  # ...\n  \"wagtail.api.v2\",\n  \"rest_framework\",\n  \"wagtail_sb_imageserializer\",\n  # ...\n]\n```\n\nIn your model specify the `ImageSerializerField` as serializer for the `APIField` related to the image field and add the `renditions` parameter with the renditions you want to render.\n\n```python\nfrom wagtail.models import Page\nfrom wagtail.api import APIField\nfrom wagtail_sb_imageserializer.fields import ImageSerializerField\n\nclass SamplePage(Page):\n    image = ImageSerializerField()\n\n    api_fields = [\n        APIField(\n          \"image\",\n          serializer=ImageSerializerField(\n              renditions={\n                  \"lazy\": \"fill-50x50\",\n                  \"mobile\": \"fill-128x128\",\n                  \"tablet\": \"fill-256x256\",\n                  \"desktop\": \"fill-512x512\",\n              }\n          ),\n        ),\n    ]\n```\n\nWhen yo require your page from the API, the image filed will looks like this\n\n```json\n{\n    \"id\": 1234567890,\n    \"meta\": {\n        \"type\": \"wagtailimages.Image\",\n        \"title\": \"Image title\",\n        \"alt\": \"Image alt text\"\n    },\n    \"original\": {\n        \"width\": 123456788890,\n        \"height\": 123456788890,\n        \"download_url\": \"https://your-cdn-domain/path/to/original_images/image_name.png\"\n    },\n    \"renditions\": {\n        \"lazy\": {\n            \"width\": 50,\n            \"height\": 50,\n            \"download_url\": \"https://your-cdn-domain/path/to/reditions/image_name.fill-50x50.png\"\n        },\n        \"mobile\": {\n            \"width\": 128,\n            \"height\": 128,\n            \"download_url\": \"https://your-cdn-domain/path/to/reditions/image_name.fill-128x128.png\"\n        },\n        \"tablet\": {\n            \"width\": 256,\n            \"height\": 256,\n            \"download_url\": \"https://your-cdn-domain/path/to/reditions/image_name.fill-256x256.png\"\n        },\n        \"desktop\": {\n            \"width\": 512,\n            \"height\": 512,\n            \"download_url\": \"https://your-cdn-domain/path/to/reditions/image_name.fill-512x512.png\"\n        }\n    }\n},\n```\n\n## Docs\n\n- [Ejemplos](https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/wikis)\n- [Wiki](https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/wikis)\n\n## Changelog\n\nAll changes to versions of this library are listed in the [change history](CHANGELOG.md).\n\n## Development\n\nCheck out our [contribution guide](CONTRIBUTING.md).\n\n## Contributors\n\nSee the list of contributors [here](https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/graphs/develop).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Social Networks settings for wagtail sites.",
    "version": "0.4.0",
    "project_urls": {
        "Bug Tracker": "https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/issues",
        "Documentation": "https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/wikis",
        "Download": "https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer/-/archive/v0.4.0/wagtail-sb-imageserializer-v0.4.0.tar.gz",
        "Homepage": "https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer",
        "Repository": "https://gitlab.com/softbutterfly/open-source/wagtail-sb-imageserializer"
    },
    "split_keywords": [
        "softbutterfly",
        "django",
        "migrations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fad1e3bd6328d5fe0aaa27350be36555dc504dae3ea18d35da64b3adbc0a066e",
                "md5": "c3b72c96ef92eb2c2a960f8ea1f083f4",
                "sha256": "89b59fc55dc3c456746319b34ffcad9c037836c8734b58fd14e7af2609b537d6"
            },
            "downloads": -1,
            "filename": "wagtail_sb_imageserializer-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c3b72c96ef92eb2c2a960f8ea1f083f4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 7048,
            "upload_time": "2023-06-26T02:24:07",
            "upload_time_iso_8601": "2023-06-26T02:24:07.542680Z",
            "url": "https://files.pythonhosted.org/packages/fa/d1/e3bd6328d5fe0aaa27350be36555dc504dae3ea18d35da64b3adbc0a066e/wagtail_sb_imageserializer-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0d4b98ad1e7158b46e91f7000a289060598e89661c72e2e24dc4da6030b6119",
                "md5": "b31e4da851f058379fd3d2026ebfe4a8",
                "sha256": "45d5b7311df9893c283766bf1933059de04a4ed003d369d06b23de6a0fc28545"
            },
            "downloads": -1,
            "filename": "wagtail_sb_imageserializer-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b31e4da851f058379fd3d2026ebfe4a8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 4592,
            "upload_time": "2023-06-26T02:24:08",
            "upload_time_iso_8601": "2023-06-26T02:24:08.988771Z",
            "url": "https://files.pythonhosted.org/packages/a0/d4/b98ad1e7158b46e91f7000a289060598e89661c72e2e24dc4da6030b6119/wagtail_sb_imageserializer-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-26 02:24:08",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "softbutterfly",
    "gitlab_project": "open-source",
    "lcname": "wagtail-sb-imageserializer"
}
        
Elapsed time: 0.08145s