Add annotation set transform framework

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-11-14 08:41:59 -07:00
parent 7cba86ce30
commit dd475f29c7
3 changed files with 29 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ class GlModelTransformOutput extends MediaTransformOutput {
$this->height = $parameters['height'];
$this->view = (isset($parameters['view'])) ? $parameters['view'] : 'default';
$this->hsset = (isset($parameters['hsset'])) ? $parameters['hsset'] : 'all';
$this->transform = (isset($parameters['settrans'])) ? preg_split("/[\s,]+/", $parameters['settrans']) : [];
$this->url = $file->getFullUrl();
$this->thumb = isset($parameters['isFilePageThumb']) && $parameters['isFilePageThumb'];
}
@@ -112,6 +113,15 @@ class GlModelTransformOutput extends MediaTransformOutput {
} else {
$annotations = $metadata['annotations'];
}
//Apply any request transformations
if ($this->transform) {
if (in_array('alpha',$this->transform)) {
ksort($annotations);
}
}
//Create hotspot elements
foreach($annotations as $label => $an) {
$elAnnot = Html::rawElement('div',['class' => 'HotspotAnnotation HiddenAnnotation'],$label);
$hsDefault = array(