Skip to content

Commit

Permalink
Use MimeTypeGuesserInterface. (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiel committed Jul 20, 2023
1 parent 0ba57c3 commit 0f993e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"drupal/token": "^1.3"
},
"conflict": {
"drupal/core": "<=8"
"drupal/core": "<9.1"
},
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion openseadragon.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'OpenSeadragon Viewer'
type: module
description: 'A light-weight, customizable OpenSeadragon field formatter'
package: Media
core_version_requirement: ^9 || ^10
core_version_requirement: ^9.1 || ^10
dependencies:
- token:token
configure: openseadragon.admin_settings
10 changes: 5 additions & 5 deletions src/File/FileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Drupal\file\Entity\File;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Mime\MimeTypesInterface;
use Symfony\Component\Mime\MimeTypeGuesserInterface;

/**
* Gets file information for the image to be viewed.
Expand All @@ -16,17 +16,17 @@ class FileInformation implements FileInformationInterface {
/**
* File MimeType Guesser to use extension to determine file type.
*
* @var \Symfony\Component\Mime\MimeTypesInterface
* @var \Symfony\Component\Mime\MimeTypeGuesserInterface
*/
private $mimetypeGuesser;

/**
* FileInformation constructor.
*
* @param \Symfony\Component\Mime\MimeTypesInterface $mimeTypeGuesser
* @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mimeTypeGuesser
* File mimetype guesser interface.
*/
public function __construct(MimeTypesInterface $mimeTypeGuesser) {
public function __construct(MimeTypeGuesserInterface $mimeTypeGuesser) {
$this->mimetypeGuesser = $mimeTypeGuesser;
}

Expand All @@ -51,7 +51,7 @@ public function getFileData(File $file) {
$mime_type = $file->getMimeType();
if (strpos($mime_type, 'image/') === FALSE) {
// Try a better mimetype guesser.
$mime_type = $this->mimetypeGuesser->guess($uri);
$mime_type = $this->mimetypeGuesser->guessMimeType($uri);
if (strpos($mime_type, 'image/') === FALSE) {
// If we still don't have an image. Exit.
return $output;
Expand Down

0 comments on commit 0f993e9

Please sign in to comment.