Skip to content
Snippets Groups Projects

Issue #2644468: Multiple image upload breaks image dimensions

Closed Issue #2644468: Multiple image upload breaks image dimensions
2 unresolved threads
Closed mondrake requested to merge issue/drupal-2644468:2644468-multiple-image-upload into 9.2.x
2 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Lee Rowlands
  • Lee Rowlands
  • Lee Rowlands
  • mondrake added 9 commits

    added 9 commits

    Compare with previous version

  • mondrake added 1 commit
  • mondrake added 1 commit

    added 1 commit

    Compare with previous version

  • mondrake resolved all threads

    resolved all threads

  • 185 186 return $element;
    186 187 }
    187 188
    189 /**
    190 * {@inheritdoc}
    191 */
    192 public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
    193 // Since the file upload widget now supports uploads of more than one file
    194 // at a time it always returns an array of fids. We have to translate this
    195 // to a single fid, as the field expects a single value. In this process, we
    196 // have to unset any image dimension for files other than the first, so that
    197 // the dimensions are not copied from those of the first file.
    198 $new_values = [];
    199 foreach ($values as &$value) {
  • 335 $field_name = $element['#field_name'];
    336 $parents = $element['#field_parents'];
    337
    338 $submitted_values = NestedArray::getValue($form_state->getValues(), array_slice($button['#parents'], 0, -2));
    339 foreach ($submitted_values as $delta => $submitted_value) {
    340 if (empty($submitted_value['fids'])) {
    341 unset($submitted_values[$delta]);
    342 }
    343 }
    344
    345 // If there are more files uploaded via the same widget, we have to
    346 // separate them, as we display each file in its own widget. In this
    347 // process, we have to unset any image dimension for files after the first,
    348 // that would otherwise be copied from those of the first file.
    349 $new_values = [];
    350 foreach ($submitted_values as $delta => $submitted_value) {
  • closed

  • Please register or sign in to reply
    Loading