struct

DynFork::Fields::ImageField

Inherits DynFork::Fields::Field < JSON::Serializable < Struct < Value < Object

Image upload field. NOTE: How to use, see example.

Constructors

new(label : String = "", default : String | Nil = nil, placeholder : String = "", target_dir : String = "images", thumbnails : Array(Tuple(String, Int32)) | Nil = nil, maxsize : Int64 = 2097152, hide : Bool = false, required : Bool = false, disabled : Bool = false, readonly : Bool = false, ignored : Bool = false, hint : String = "", warning : Array(String) = Array(String).new)
Source

Instance methods

accept

HTML attribute: accept. NOTE: Describing which file types to allow. NOTE: Example: "image/png,image/jpeg,image/webp" NOTE: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept#unique_file_type_specifiers

Source
default

Default file path. NOTE: Example: "public/media/default/noavatar.jpg"

Source
default?

Default file path. NOTE: Example: "public/media/default/noavatar.jpg"

Source
extract_images_dir_path

For the DynFork::QPaladins::Check#check method.

Source
extract_img_data

For the DynFork::QPaladins::Check#check method.

Source
field_type

Field type - Structure Name.

Source
from_base64(base64 : String | Nil = nil, filename : String | Nil = nil, delete : Bool = false) : Nil

Convert base64 to a image and save in the target directory. filename: Example: foo.pdf

Source
from_path(path : String | Nil = nil, delete : Bool = false) : Nil

Convert path to a image and save in the target directory.

Source
group

To optimize field traversal in the paladins/check() method. WARNING: It is recommended not to change.

Source
input_type

Html tag: input type="file".

Source
input_type?

Html tag: input type="file".

Source
maxsize

The maximum allowed image size in bytes. NOTE: 1 MB = 1048576 Bytes (in binary).

Source
media_root

Root directory for storing media files.

Source
media_root=(media_root : String)

Root directory for storing media files.

Source
media_url

URL address for the media directory.

Source
placeholder

Displays prompt text.

Source
readonly=(readonly : Bool)

Specifies that the field cannot be modified by the user.

Source
readonly?

Specifies that the field cannot be modified by the user.

Source
refrash_val_img_data(val : DynFork::Globals::ImageData) : Nil

For the DynFork::QPaladins::Tools#refrash_fields method.

Source
required?

Required field.

Source
target_dir

Directory for images inside media directory. NOTE: Examples: avatars|photos|images

Source
thumbnails

From one to four inclusive. NOTE: Example: [{"xs", 150}, {"sm", 300}, {"md", 600}, {"lg", 1200}]

Source
thumbnails?

From one to four inclusive. NOTE: Example: [{"xs", 150}, {"sm", 300}, {"md", 600}, {"lg", 1200}]

Source
value

Sets the value of an element.

Source
value=(value : DynFork::Globals::ImageData | Nil)

Sets the value of an element.

Source
value?

Sets the value of an element.

Source