# frappe-better-attach-control **Repository Path**: nrtyck/frappe-better-attach-control ## Basic Information - **Project Name**: frappe-better-attach-control - **Description**: 一个多图片上传控件目前好像不能正常工作 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-10-18 - **Last Updated**: 2022-10-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Frappe Better Attach Control A small plugin for Frappe that adds the support of customizations to the attach control. ### Table of Contents --- ### Requirements - Frappe >= v13.0.0 --- ### Setup #### Install 1. Get the plugin from Github *(Required only once)* `bench get-app https://github.com/kid1194/frappe-better-attach-control` 2. Install the plugin on any instance/site you want `bench --site [sitename] install-app frappe_better_attach_control` 3. Check the usage section below #### Update 1. Go to the app directory (frappe-bench/apps/frappe_better_attach_control) and execute: `git pull` 2. Go back to the frappe-bench directory and execute: `bench --site [sitename] migrate` 3. *In case you need to restart bench, execute:* `bench restart` #### Uninstall 1. Uninstall the plugin from the instance/site `bench --site [sitename] uninstall-app frappe_better_attach_control` 2. Uninstall the plugin from bench `bench remove-app frappe_better_attach_control` --- ### Usage 1. Go to Customization > Customize Form 2. Enter the form type/name (Ex: 'User') 3. Scroll down to the form fields area and edit the `Attach` or `Attach Image` fields you want 4. In the `options` property of the fields, add a JSON object of the customizations you want. Example: `{"allowed_file_types": ["jpg", "png", "gif"]}` --- ### Available Options
upload_notes

Upload text to be displayed.

Example: "Only allowed to upload images and video, with maximum size of 2MB"

Default: ""

allow_multiple

Allow multiple uploads.

⚠️(Field value is a JSON array of files url)

Default: false

max_file_size

Maximum file size (in bytes) that is allowed to be uploaded.

Example: 2048 for 2KB

Default: Value of maximum file size in Frappe's settings

allowed_file_types

Array of allowed file types (mimes) or extensions to upload.

Example: ["image/*", "video/*", ".pdf", ".doc"]

Default: null or ["image/*"]

max_number_of_files

Maximum number of files allowed to be uploaded if multiple upload is allowed.

⚠️(Bypassing the maximum attachments of doctype might not work)

Example: 4

Default: Value of maximum attachments set for the doctype

crop_image_aspect_ratio

Crop aspect ratio for images (Frappe >= v14.0.0).

Example: 1 or 16/9 or 4/3

Default: 1

--- ### Supported Fields - Attach - Attach Image --- ### ToDo --- ### License MIT