struct DynFork::Fields::ImageField
  
  - DynFork::Fields::ImageField
 - DynFork::Fields::Field
 - Struct
 - Value
 - Object
 
Overview
Image upload field.
NOTE How to use, see example.
Defined in:
dynfork/fields/image.crConstructors
- .new(pull : JSON::PullParser)
 - .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)
 
Instance Method Summary
- 
        #accept : String
        
          
HTML attribute: accept.
 - 
        #default : String | Nil
        
          
Default file path.
 - 
        #default? : String | Nil | Nil
        
          
Default file path.
 - 
        #extract_images_dir_path : String | Nil
        
          
For the
DynFork::QPaladins::Check#checkmethod. - 
        #extract_img_data : DynFork::Globals::ImageData | Nil
        
          
For the
DynFork::QPaladins::Check#checkmethod. - 
        #field_type : String
        
          
Field type - Structure Name.
 - 
        #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.
 - 
        #from_path(path : String | Nil = nil, delete : Bool = false) : Nil
        
          
Convert path to a image and save in the target directory.
 - 
        #group : UInt8
        
          
To optimize field traversal in the
paladins/check()method. - 
        #input_type : String | Nil
        
          
Html tag: input type="file".
 - 
        #input_type? : String | Nil | Nil
        
          
Html tag: input type="file".
 - 
        #maxsize : Int64
        
          
The maximum allowed image size in bytes.
 - 
        #media_root : String
        
          
Root directory for storing media files.
 - 
        #media_root=(media_root : String)
        
          
Root directory for storing media files.
 - 
        #media_url : String
        
          
URL address for the media directory.
 - 
        #placeholder : String
        
          
Displays prompt text.
 - 
        #readonly=(readonly : Bool)
        
          
Specifies that the field cannot be modified by the user.
 - 
        #readonly? : Bool
        
          
Specifies that the field cannot be modified by the user.
 - 
        #refrash_val_img_data(val : DynFork::Globals::ImageData) : Nil
        
          
For the
DynFork::QPaladins::Tools#refrash_fieldsmethod. - 
        #required? : Bool
        
          
Required field.
 - 
        #target_dir : String
        
          
Directory for images inside media directory.
 - 
        #thumbnails : Array(Tuple(String, Int32)) | Nil
        
          
From one to four inclusive.
 - 
        #thumbnails? : Array(Tuple(String, Int32)) | Nil | Nil
        
          
From one to four inclusive.
 - 
        #value : DynFork::Globals::ImageData | Nil
        
          
Sets the value of an element.
 - 
        #value=(value : DynFork::Globals::ImageData | Nil)
        
          
Sets the value of an element.
 - 
        #value? : DynFork::Globals::ImageData | Nil | Nil
        
          
Sets the value of an element.
 
Instance methods inherited from struct DynFork::Fields::Field
  
  
    
      choices_from_json(json : String) : Nil
    choices_from_json, 
    
  
    
      disabled=(disabled : Bool)
    disabled=, 
    
  
    
      disabled? : Bool
    disabled?, 
    
  
    
      errors : Array(String)
    errors, 
    
  
    
      errors=(errors : Array(String))
    errors=, 
    
  
    
      field_type : String
    field_type, 
    
  
    
      group : UInt8
    group, 
    
  
    
      hide=(hide : Bool)
    hide=, 
    
  
    
      hide? : Bool
    hide?, 
    
  
    
      hint : String
    hint, 
    
  
    
      id : String
    id, 
    
  
    
      id=(id : String)
    id=, 
    
  
    
      ignored? : Bool
    ignored?, 
    
  
    
      label : String
    label, 
    
  
    
      name : String
    name, 
    
  
    
      name=(name : String)
    name=, 
    
  
    
      slug_sources : Array(String)
    slug_sources, 
    
  
    
      warning : Array(String)
    warning, 
    
  
    
      warning=(warning : Array(String))
    warning=
    
  
    
  Constructor methods inherited from struct DynFork::Fields::Field
  
  
    
      new(pull : JSON::PullParser)
    new
    
  
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
Constructor Detail
Instance Method Detail
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
Default file path.
NOTE Example: "public/media/default/noavatar.jpg"
For the DynFork::QPaladins::Check#check method.
Convert base64 to a image and save in the target directory. filename: Example: foo.pdf
Convert path to a image and save in the target directory.
To optimize field traversal in the paladins/check() method.
WARNING It is recommended not to change.
The maximum allowed image size in bytes.
NOTE 1 MB = 1048576 Bytes (in binary).
For the DynFork::QPaladins::Tools#refrash_fields method.
Directory for images inside media directory.
NOTE Examples: avatars|photos|images
From one to four inclusive.
NOTE Example: [{"xs", 150}, {"sm", 300}, {"md", 600}, {"lg", 1200}]
From one to four inclusive.
NOTE Example: [{"xs", 150}, {"sm", 300}, {"md", 600}, {"lg", 1200}]