Skip to content

Commit

Permalink
[ALLI-7369] EAD3: Improve image handling (vufind-org#2254)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuomaJuha committed Mar 4, 2022
1 parent b625328 commit 5fc7f9a
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 214 deletions.
4 changes: 2 additions & 2 deletions local/config/finna/config.ini.sample
Expand Up @@ -699,8 +699,8 @@ lastname = SHIB_sn
;coverimages = Syndetics:MySyndeticsId,Amazon:MyAccessKeyId,Booksite,LibraryThing:MyLibraryThingId,Google,OpenLibrary,Summon:MySerialsSolutionsClientKey,Contentcafe:MyContentCafeID,NatLibFi,BookyFi,BTJ:customerId
coverimages = NatLibFi,OpenLibrary

; List of blocked formats prevented from showing in LIDO records image section
; lidoFileFormatBlockList = 'tif,tiff,3d-pdf,3d model,glb,obj,gltf'
; List of undisplayable file formats
; undisplayable_file_formats = 'tif:tiff:3d-pdf:3d model:glb:obj:gltf'

; This setting controls the image to display when no book cover is available.
; The path is relative to the base of your theme directory.
Expand Down
26 changes: 26 additions & 0 deletions module/Finna/src/Finna/RecordDriver/Feature/SolrFinnaTrait.php
Expand Up @@ -60,6 +60,13 @@ trait SolrFinnaTrait
*/
protected $cache = [];

/**
* An array of non-displayable formats
*
* @var array
*/
protected $undisplayableFormats;

/**
* Return an array of image URLs associated with this record with keys:
* - urls Image URLs
Expand Down Expand Up @@ -763,6 +770,25 @@ public function isAuthorityRecord()
return false;
}

/**
* Can the format not be properly displayed?
*
* @param string $format Format to check.
*
* @return bool
*/
public function isUndisplayableFormat(string $format): bool
{
if (!isset($this->undisplayableFormats)) {
$this->undisplayableFormats = explode(
':',
$this->mainConfig->Record->undisplayable_file_formats
?? 'tif:tiff:3d-pdf:3d model:glb:obj:gltf'
);
}
return in_array($format, $this->undisplayableFormats);
}

/**
* Support method for getOpenURL() -- pick the OpenURL format.
*
Expand Down

0 comments on commit 5fc7f9a

Please sign in to comment.