Problem/Motivation

The ImageKit integration currently uploads source videos to ImageKit as base64 payloads. That works for smaller files, but it fails for larger videos because ImageKit rejects base64 uploads above 100MB.

A typical failure looks like this:

Queued ImageKit upload retry failed for file ID 1741 and video style imagekit_1920x1080_av1: HTTP 400: You are sending file as base64 which is above 100MB. Please send the file as binary or a public URL.

This means the current implementation is too rigid. The module should support the upload methods that ImageKit itself supports and should use the safest default for Drupal-managed video files.

Steps to reproduce

  1. Install video_style and video_style_imagekit.
  2. Configure ImageKit credentials.
  3. Create an ImageKit-backed video style.
  4. Upload a video larger than 100MB and render it through the ImageKit video style so that sync is requested.
  5. Run queue processing or cron.
  6. Observe that the upload fails because the module uses a base64 payload.

Proposed resolution

Add a Drupal-managed ImageKit upload-method setting and make binary upload the default.

The provider admin page at /admin/config/media/video-styles/imagekit should expose a first Settings section with an Upload method select offering:

  • Binary upload (default)
  • Base64 upload
  • Fetch from public URL

Implementation details:

  • Use a real config object so the selected upload method is exported with configuration.
  • Ship default config with binary as the default value.
  • Use the current configured upload method at execution time for new syncs and queued retries.
  • Implement binary upload using a file handle/resource instead of reading the whole file into memory as a base64 payload.
  • Only allow public-URL uploads when the source file is in the public file system, and document that ImageKit must be able to reach the URL.

Remaining tasks

  • Add the new video_style_imagekit.settings config object and schema.
  • Add the upload-method UI to the ImageKit provider settings page.
  • Update sync execution to support binary, base64, and public-URL upload modes.
  • Ensure queued retries always use the current configured upload method.
  • Document the new setting and its operational caveats.
  • Add an update path for existing installs so the default config is created.

User interface changes

Yes.

The ImageKit provider admin page gains a new Settings section with an Upload method select and a save action. The help text should explain that binary upload is the recommended default, that base64 uploads are limited to 100MB by ImageKit, and that public-URL uploads require ImageKit to be able to reach the original file.

API changes

No external API changes.

This issue changes internal provider behavior and admin configuration only.

Data model changes

Yes.

A new Drupal config object is introduced for provider runtime settings:

video_style_imagekit.settings

It stores the selected upload method and is intended to be exported with site configuration.

Comments

dpacassi created an issue. See original summary.

  • dpacassi committed 4288dc6d on 1.0.x
    Issue #3587315 by dpacassi: Allow configuring the ImageKit upload method...
dpacassi’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.