# netlify-lfs-resize-url
![PyPI - License](https://img.shields.io/pypi/l/lektor-netlify-lfs-resize-url) [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) ![PyPI - Downloads](https://img.shields.io/pypi/dw/lektor-netlify-lfs-resize-url)
## Please note!
Netlify Large Media has now [been deprecated](https://answers.netlify.com/t/large-media-feature-deprecated-but-not-removed/100804). This plugin will no longer be maintained. I would like to take this opportunity to thank everyone who's used it - I hope you've been happy with the service it has provided.
## Description
This plugin provides a filter that allows the user to generate [Netlify Image Transformation](https://www.netlify.com/docs/image-transformation/) resize URL parameters when working with [Netlify Large Media](https://www.netlify.com/docs/large-media/).
## Installation
You can install this plugin by running the following command in your project's directory:
```sh
lektor plugins add netlify-lfs-resize-url
```
## Usage
The `nf_resize` filter works in conjunction with the `url` filter as follows:
```jinja
{% for image in this.attachments.images %}
<img src="{{ image|url|nf_resize(w=720) }}">
{% endfor %}
```
The above will return the following:
```html
<img src="/images/example.png?nf_resize=fit&w=720">
```
### Arguments
Arguments correspond to [Netlify transformation parameters](https://www.netlify.com/docs/image-transformation/#parameters-for-transformation).
| Argument | Accepts | Default |
|-------------|--------------------|---------|
| `nf_resize` | 'fit', 'smartcrop' | 'fit' |
| `h` | Positive integers | `null` |
| `w` | Positive integers | `null` |
## Development
### Testing
All of the tests can be run by executing `test.sh` with the pipenv shell activated.
#### Static analysis and checking
`mypy` is used for static analysis, and `flake8` is used for checking:
```sh
python -m mypy lektor_netlify_lfs_resize_url.py
python -m mypy test.py
python -m flake8 lektor_netlify_lfs_resize_url.py
python -m flake8 test.py
```
#### Unit testing
Python's built-in `unittest` framework is used for unit testing:
```sh
python -m unittest
```
#### Security
`bandit` is used for security testing:
```sh
python -m bandit lektor_netlify_lfs_resize_url.py
```
### Uploading the plugin to PyPI
```sh
python -m build
python -m twine upload dist/*
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/JM0804/lektor-netlify-lfs-resize-url",
"name": "lektor-netlify-lfs-resize-url",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Lektor plugin",
"author": "Jonathan Mason",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/31/e7/748664fb9331649549772074fc8abd4bb4c0fa363c542e89b77fadd54556/lektor_netlify_lfs_resize_url-1.0.3.tar.gz",
"platform": null,
"description": "# netlify-lfs-resize-url\n\n![PyPI - License](https://img.shields.io/pypi/l/lektor-netlify-lfs-resize-url) [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) ![PyPI - Downloads](https://img.shields.io/pypi/dw/lektor-netlify-lfs-resize-url)\n\n## Please note!\n\nNetlify Large Media has now [been deprecated](https://answers.netlify.com/t/large-media-feature-deprecated-but-not-removed/100804). This plugin will no longer be maintained. I would like to take this opportunity to thank everyone who's used it - I hope you've been happy with the service it has provided.\n\n## Description\n\nThis plugin provides a filter that allows the user to generate [Netlify Image Transformation](https://www.netlify.com/docs/image-transformation/) resize URL parameters when working with [Netlify Large Media](https://www.netlify.com/docs/large-media/).\n\n## Installation\n\nYou can install this plugin by running the following command in your project's directory:\n\n```sh\nlektor plugins add netlify-lfs-resize-url\n```\n\n## Usage\n\nThe `nf_resize` filter works in conjunction with the `url` filter as follows:\n\n```jinja\n{% for image in this.attachments.images %}\n <img src=\"{{ image|url|nf_resize(w=720) }}\">\n{% endfor %}\n```\n\nThe above will return the following:\n\n```html\n<img src=\"/images/example.png?nf_resize=fit&w=720\">\n```\n\n### Arguments\n\nArguments correspond to [Netlify transformation parameters](https://www.netlify.com/docs/image-transformation/#parameters-for-transformation).\n\n| Argument | Accepts | Default |\n|-------------|--------------------|---------|\n| `nf_resize` | 'fit', 'smartcrop' | 'fit' |\n| `h` | Positive integers | `null` |\n| `w` | Positive integers | `null` |\n\n## Development\n\n### Testing\n\nAll of the tests can be run by executing `test.sh` with the pipenv shell activated.\n\n#### Static analysis and checking\n\n`mypy` is used for static analysis, and `flake8` is used for checking:\n\n```sh\npython -m mypy lektor_netlify_lfs_resize_url.py\npython -m mypy test.py\npython -m flake8 lektor_netlify_lfs_resize_url.py\npython -m flake8 test.py\n```\n\n#### Unit testing\n\nPython's built-in `unittest` framework is used for unit testing:\n\n```sh\npython -m unittest\n```\n\n#### Security\n\n`bandit` is used for security testing:\n\n```sh\npython -m bandit lektor_netlify_lfs_resize_url.py\n```\n\n### Uploading the plugin to PyPI\n\n```sh\npython -m build\npython -m twine upload dist/*\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert image URLs to Netlify LFS resize URLs.",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://gitlab.com/JM0804/lektor-netlify-lfs-resize-url"
},
"split_keywords": [
"lektor",
"plugin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eff2db3696e317436fc60a02e5453792b0f21f4964e1b099d9693a7e6d38254f",
"md5": "22925ede0bd7c59e2471910d65ce9393",
"sha256": "1b12c0a1646010af7381d075b2581fc31bac20d15e81aa481c3f33ab58694ce5"
},
"downloads": -1,
"filename": "lektor_netlify_lfs_resize_url-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "22925ede0bd7c59e2471910d65ce9393",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4181,
"upload_time": "2024-04-14T19:32:15",
"upload_time_iso_8601": "2024-04-14T19:32:15.258459Z",
"url": "https://files.pythonhosted.org/packages/ef/f2/db3696e317436fc60a02e5453792b0f21f4964e1b099d9693a7e6d38254f/lektor_netlify_lfs_resize_url-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "31e7748664fb9331649549772074fc8abd4bb4c0fa363c542e89b77fadd54556",
"md5": "28137013783f6265dc4542ac8a1180dd",
"sha256": "26dfe8bd921cf80ae5059f28fa7ebde84dd269c0136d08a732d64be36f0af554"
},
"downloads": -1,
"filename": "lektor_netlify_lfs_resize_url-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "28137013783f6265dc4542ac8a1180dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3555,
"upload_time": "2024-04-14T19:32:17",
"upload_time_iso_8601": "2024-04-14T19:32:17.245109Z",
"url": "https://files.pythonhosted.org/packages/31/e7/748664fb9331649549772074fc8abd4bb4c0fa363c542e89b77fadd54556/lektor_netlify_lfs_resize_url-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-14 19:32:17",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "JM0804",
"gitlab_project": "lektor-netlify-lfs-resize-url",
"lcname": "lektor-netlify-lfs-resize-url"
}