Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to upload JP2 Image #7

Open
kylehuynh205 opened this issue Jun 14, 2023 · 0 comments
Open

Unable to upload JP2 Image #7

kylehuynh205 opened this issue Jun 14, 2023 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@kylehuynh205
Copy link

To reproduce:

Run isle-dc, when going to add image via https://islandora.traefik.me/media/add/image it only provides 4 options. Allow types: png gif jpg jpeg in image uploader widget. Same thing, when we edit it from the node (i.e remove the image, then add it back).

4 file extension option is set in \Drupal::service('image.factory'), if we look in to the web/core/modules/file/file.module

MicrosoftTeams-image

We found:

It seems the image factory used in this case is \Drupal\system\Plugin\ImageToolkit\GDToolkit.php. In its supportedTypes() function only PNG, JPEG, GIF, and WEBP are listed.

 public static function getSupportedExtensions() {
    $extensions = [];
    foreach (static::supportedTypes() as $image_type) {
      // @todo Automatically fetch possible extensions for each mime type.
      // @see https://www.drupal.org/node/2311679
      $extension = mb_strtolower(image_type_to_extension($image_type, FALSE));
      $extensions[] = $extension;
      // Add some known similar extensions.
      if ($extension === 'jpeg') {
        $extensions[] = 'jpg';
        $extensions[] = 'jpe';
      }
    }
    return $extensions;
  }

  protected static function supportedTypes() {
    return [IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_WEBP];
  }

The Workaround:

protected static function supportedTypes() {
    return [IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_WEBP, IMAGETYPE_JP2, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM];
  }

... we have

MicrosoftTeams-image (1)

Ongoing Issuees:

  • Unable to generate derivatives

MicrosoftTeams-image (2)

  • Extend that fixes into a external module instead of modifying the Drupal core

Resource links
https://www.drupal.org/project/drupal/issues/3204467
https://www.drupal.org/project/drupal/issues/1014816#comment-7891559

@kylehuynh205 kylehuynh205 added bug Something isn't working enhancement New feature or request labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant