@php if (!isset($field['wrapperAttributes']) || !isset($field['wrapperAttributes']['data-init-function'])){ $field['wrapperAttributes']['data-init-function'] = 'bpFieldInitCropperImageElement'; } if (!isset($field['wrapperAttributes']) || !isset($field['wrapperAttributes']['data-field-name'])) { $field['wrapperAttributes']['data-field-name'] = $field['name']; } if (!isset($field['wrapperAttributes']) || !isset($field['wrapperAttributes']['class'])) { $field['wrapperAttributes']['class'] = "form-group col-sm-12 cropperImage"; } elseif (isset($field['wrapperAttributes']) && isset($field['wrapperAttributes']['class'])) { $field['wrapperAttributes']['class'] .= " cropperImage"; } $prefix = isset($field['prefix']) ? $field['prefix'] : ''; $value = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? ''; $image_url = $value ? preg_match('/^data\:image\//', $value) ? $value : (isset($field['disk']) ? Storage::disk($field['disk'])->url($prefix.$value) : url($prefix.$value)) :''; // if validation failed, tha value will be base64, so no need to create a URL for it if (! function_exists('maximumServerUploadSizeInBytes')) { function maximumServerUploadSizeInBytes() { $val = trim(ini_get('upload_max_filesize')); $last = strtolower($val[strlen($val)-1]); switch($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val = (int)$val * 1073741824; break; case 'm': $val = (int)$val * 1048576; break; case 'k': $val = (int)$val * 1024; break; } return $val; } } $max_image_size_in_bytes = $field['max_file_size'] ?? (int)maximumServerUploadSizeInBytes(); @endphp
{!! $field['hint'] !!}
@endif