{"id":15566784,"url":"https://github.com/rstit/flask-image-alchemy","last_synced_at":"2025-08-12T10:04:42.708Z","repository":{"id":57430393,"uuid":"82030203","full_name":"rstit/flask-image-alchemy","owner":"rstit","description":"SQLAlchemy Standarized Image Field for Flask","archived":false,"fork":false,"pushed_at":"2023-04-18T05:23:15.000Z","size":63,"stargazers_count":18,"open_issues_count":7,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-30T08:57:30.560Z","etag":null,"topics":["filestorage","flask","flask-extensions","image-processing","s3-storage","thumbnails"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-02-15T07:00:20.000Z","updated_at":"2022-12-26T14:24:06.000Z","dependencies_parsed_at":"2024-11-16T03:11:31.645Z","dependency_job_id":"792a21e1-f9fb-4ce4-ad2e-510cfb66d80e","html_url":"https://github.com/rstit/flask-image-alchemy","commit_stats":{"total_commits":107,"total_committers":2,"mean_commits":53.5,"dds":"0.028037383177570097","last_synced_commit":"1e4cf7f82e4d3d3b3589343fe5fe713669a33c58"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rstit/flask-image-alchemy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstit%2Fflask-image-alchemy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstit%2Fflask-image-alchemy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstit%2Fflask-image-alchemy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstit%2Fflask-image-alchemy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstit","download_url":"https://codeload.github.com/rstit/flask-image-alchemy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstit%2Fflask-image-alchemy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270040726,"owners_count":24516684,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["filestorage","flask","flask-extensions","image-processing","s3-storage","thumbnails"],"created_at":"2024-10-02T17:06:37.471Z","updated_at":"2025-08-12T10:04:42.446Z","avatar_url":"https://github.com/rstit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Flask-ImageAlchemy\n===============================\n[![Build Status](https://travis-ci.org/rstit/flask-image-alchemy.svg?branch=master)](https://travis-ci.org/rstit/flask-image-alchemy)\n\nversion number: 0.0.7\n\nOverview\n--------\n\nSQLAlchemy Standarized Image Field for Flask\n\nFeatures\n--------\n- Storage backends (FileStorage, S3Storage)\n- Thumbnails (wand)\n- Flask Application Factory compatible\n-\n\nInstallation\n--------------------\n\nTo install use pip:\n```bash\n$ pip install Flask-ImageAlchemy\n```\n\nOr clone the repo:\n```bash\n$ git clone https://github.com/rstit/flask-image-alchemy.git\n$ python setup.py install\n```\nUsage\n-----\n#### SQLAlchemy Model\n```python\nstorage = S3Storage()\nstorage.init_app(app)\n\nclass User(db.Model):\n    __tablename__ = 'example'\n    id = db.Column(db.Integer, primary_key=True)\n    image = db.Column(\n        StdImageField(\n            storage=storage,\n            variations={\n                'thumbnail': {\"width\": 100, \"height\": 100, \"crop\": True}\n            }\n        ), nullable=True\n    )\n```\n#### Flask Settings\nIf you need S3Starage, set up config in your flask application:\n```python\nAWS_ACCESS_KEY_ID = \"you-api-key\"\nAWS_SECRET_ACCESS_KEY = \"you-secret-key\"\nAWS_REGION_NAME = \"bucket-region\"\nS3_BUCKET_NAME = \"bucket-name\"\n```\n\nIf you need FileStorage and custom `MEDIA_PATH`:\n```python\nMEDIA_PATH = \"/var/www/assets/images/\"\n```\n#### Usage in views\n```python\nu = User()\nu.avatar = file # werkzeug.datastructures.FileStorage\nu.save()\n```\nAnd you have access to thumbnails:\n```python\nu.avatar.url\nu.avatar.thumbnail\nu.avatar.thumbnail.url\nu.avatar.thumbnail.path\n```\n#### Deleting images\n\nImplementing file deletion should be done inside your own applications using the `before_delete` \nsignal. Clearing the field if blank is true, does not delete the file. This can also be achieved \nusing `before_update` signals. This packages contains two event callback methods that handle file \ndeletion for all SdtImageFields of a model.\n\n```python\nfrom flask_image_alchemy.events import before_update_delete_callback, before_delete_delete_callback\nfrom sqlalchemy.event import listen\nlisten(User, 'before_update', before_update_delete_callback)\nlisten(User, 'before_delete', before_delete_delete_callback)\n```\n\nTODO\n------------\n* Validators (MinSizeValidator, MaxSizeValidator)\n* Flask-Admin widget\n* Coverage\n* Docs Page\n* Async Jobs (Image Processing)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstit%2Fflask-image-alchemy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstit%2Fflask-image-alchemy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstit%2Fflask-image-alchemy/lists"}