You are here

public function PluploadWidgetTrait::getChunkSize in PlUPload File Widget 8

Get the optimum chunk size.

2 calls to PluploadWidgetTrait::getChunkSize()
FileWidget::form in src/Plugin/Field/FieldWidget/FileWidget.php
Creates a form element for a field.
ImageWidget::form in src/Plugin/Field/FieldWidget/ImageWidget.php
Creates a form element for a field.

File

src/Plugin/Field/FieldWidget/PluploadWidgetTrait.php, line 25

Class

PluploadWidgetTrait

Namespace

Drupal\plupload_widget\Plugin\Field\FieldWidget

Code

public function getChunkSize() {

  // 500 Kb per chunk does not sound bad...
  $good_size = 1024 * 500;

  // This is what the PLUPLOAD module
  // field element takes as the default
  // chunk size.
  $size = Bytes::toInt(ini_get('post_max_size'));
  if ($size > $good_size) {
    $size = $good_size;
  }
  return $size;
}