Skip to content

Commit

Permalink
Merge pull request #1 from Islandora-Devops/1827-image-template
Browse files Browse the repository at this point in the history
Image theme template preprocess produces broken IIIF URL. (#1827)
  • Loading branch information
dannylamb authored May 19, 2021
2 parents c5fc95b + d2e28d9 commit e6179bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions islandora_base_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ function islandora_base_theme_preprocess_image(&$variables)

// Get File URL, and strip out query params if the file isn't temporary.
$file_url = file_create_url($variables['uri']);
if (strpos($file_url, '/system/temporary') === false) {
if (strpos($file_url, '/system/temporary') === false
&& strpos($file_url, '?') !== false) {
$file_url = strstr($file_url, '?', TRUE);
}

// Get the size from the image style if applicable.
if (isset($variables['style_name']) && !empty($variables['style_name'])) {
$file_url = str_replace("/styles/" . $variables['style_name'] . "/", "/", $file_url);
$style_config = ImageStyle::load($variables['style_name'])->getEffects()->getConfiguration();
foreach($style_config as $config) {
foreach($style_config as $config) {
if(isset($config['data'])) {
if(isset($config['data']['height'])) {
$image_style_height = $config['data']['height'];
Expand Down

0 comments on commit e6179bb

Please sign in to comment.