{"id":22545376,"url":"https://github.com/modbender/easy-thumbnails-rest","last_synced_at":"2025-04-09T23:51:20.597Z","repository":{"id":41903447,"uuid":"265050162","full_name":"modbender/easy-thumbnails-rest","owner":"modbender","description":"Easy Thumbnails Fields for Django Rest API","archived":false,"fork":false,"pushed_at":"2025-01-14T22:31:39.000Z","size":67,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T23:51:16.124Z","etag":null,"topics":["django","django-rest-framework","easy-thumbnails","python","rest","rest-api"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/easy-thumbnails-rest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modbender.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["modbender"],"patreon":"modbender","open_collective":null,"ko_fi":"modbender","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"custom":["paypal.me/modbender"]}},"created_at":"2020-05-18T20:10:26.000Z","updated_at":"2025-01-16T18:42:12.000Z","dependencies_parsed_at":"2024-06-18T08:56:15.262Z","dependency_job_id":"abc1cf4e-1b7f-4edc-a9d7-bd8ab2b69038","html_url":"https://github.com/modbender/easy-thumbnails-rest","commit_stats":{"total_commits":44,"total_committers":3,"mean_commits":"14.666666666666666","dds":"0.43181818181818177","last_synced_commit":"67e7e829239ab6304a0280b666d3736e1c5bec9e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modbender%2Feasy-thumbnails-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modbender%2Feasy-thumbnails-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modbender%2Feasy-thumbnails-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modbender%2Feasy-thumbnails-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modbender","download_url":"https://codeload.github.com/modbender/easy-thumbnails-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131455,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-rest-framework","easy-thumbnails","python","rest","rest-api"],"created_at":"2024-12-07T14:09:46.485Z","updated_at":"2025-04-09T23:51:20.571Z","avatar_url":"https://github.com/modbender.png","language":"Python","funding_links":["https://github.com/sponsors/modbender","https://patreon.com/modbender","https://ko-fi.com/modbender","paypal.me/modbender"],"categories":[],"sub_categories":[],"readme":"# Easy Thumbnails Rest\n\n[![Downloads](https://pepy.tech/badge/easy-thumbnails-rest)](https://pepy.tech/project/easy-thumbnails-rest)\n[![Downloads](https://pepy.tech/badge/easy-thumbnails-rest/month)](https://pepy.tech/project/easy-thumbnails-rest/month)\n[![Downloads](https://pepy.tech/badge/easy-thumbnails-rest/week)](https://pepy.tech/project/easy-thumbnails-rest/week)\n\nEasy Thumbnails Fields for Django Rest API Framework\n\n## Installation\n\n`pip install easy-thumbnails-rest`\n\nTested on Django 2.2, 3.1, 3.2\n\n## Usage\nThis package is an extension for [easy-thumbnails](https://github.com/SmileyChris/easy-thumbnails).\n\nPlease make sure to have `THUMBNAIL_ALIASES` defined in `settings.py`.\nIf not added, please check [Easy Thumbnails Docs](https://easy-thumbnails.readthedocs.io/en/latest/usage/#thumbnail-aliases) to add it.\n\nTo use the serializer fields provided by this package you need to have your image fields defined as provided here: [easy-thumbnails fields](https://github.com/SmileyChris/easy-thumbnails#fields)\n\nExample `settings.THUMBNAIL_ALIASES`\n\n```python\nTHUMBNAIL_ALIASES = {\n    '': {\n        'avatar': {'size': (50, 50), 'crop': True},\n    },\n}\n```\n\n\n## Fields\n\n- ThumbnailerSerializer\n- ThumbnailerListSerializer\n- ThumbnailerJSONSerializer\n\n### ThumbnailerSerializer\n\nYou can use `ThumbnailerSerializer` to get image's predefined alias. You need to pass argument `alias` with value as one of the aliases name defined in `THUMBNAIL_ALIASES`\n\nExample:\n\n```python\nfrom rest_framework import serializers\nfrom easy_thumbnails_rest.serializers import ThumbnailerSerializer\n\nclass ExampleSerializer(serializers.ModelSerializer):\n    image = ThumbnailerSerializer(alias='avatar')\n\n    class Meta:\n        model = ExampleModel\n        fields = '__all__'\n```\n\nFrom the above example the field `image` will contain string value of alias image url.\n\n### ThumbnailerListSerializer\n\nYou can use `ThumbnailerListSerializer` to get image's predefined alias image list. You need to pass argument `alias` with value as one of the target's in `THUMBNAIL_ALIASES`.\n\nIf you don't understand where to find target, please see the structure of the `THUMBNAIL_ALIASES` in [Easy Thumbnails Docs](https://easy-thumbnails.readthedocs.io/en/latest/usage/#thumbnail-aliases)\n\nExample:\n\n```python\nfrom rest_framework import serializers\nfrom easy_thumbnails_rest.serializers import ThumbnailerListSerializer\n\nclass ExampleSerializer(serializers.ModelSerializer):\n    image = ThumbnailerListSerializer(alias='target')\n\n    class Meta:\n        model = ExampleModel\n        fields = '__all__'\n```\n\nFrom the above example the field `image` will contain list of all aliased image urls under the given target.\n\n### ThumbnailerJSONSerializer\n\nYou can use `ThumbnailerJSONSerializer` to get image's predefined alias image list. You need to pass argument `alias` with value as one of the target's in `THUMBNAIL_ALIASES`.\n\nIf you don't understand where to find target, please see the structure of the `THUMBNAIL_ALIASES` in [Easy Thumbnails Docs](https://easy-thumbnails.readthedocs.io/en/latest/usage/#thumbnail-aliases)\n\nExample:\n\n```python\nfrom rest_framework import serializers\nfrom easy_thumbnails_rest.serializers import ThumbnailerJSONSerializer\n\nclass ExampleSerializer(serializers.ModelSerializer):\n    image = ThumbnailerJSONSerializer(alias='target')\n\n    class Meta:\n        model = ExampleModel\n          fields = '__all__'\n```\nFrom the above example the field `image` will contain list of key-value pair where key's are the alias under the given target and values are the respective image url.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodbender%2Feasy-thumbnails-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodbender%2Feasy-thumbnails-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodbender%2Feasy-thumbnails-rest/lists"}