diff options
Diffstat (limited to 'src/web/helpers/image.php')
-rw-r--r-- | src/web/helpers/image.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/web/helpers/image.php b/src/web/helpers/image.php index fd395b5..ec867b8 100644 --- a/src/web/helpers/image.php +++ b/src/web/helpers/image.php @@ -1,6 +1,7 @@ <?php /* Copyright (c) 2024 Freya Murphy */ -function __get_mime($type) { +function __get_mime($type) +{ switch ($type) { case 'mp4': return 'video/mp4'; @@ -22,15 +23,14 @@ function __get_mime($type) { function __make_source( $name, $format, - $media -) { + $media) +{ if ($media) { $media = "media=\"$media\""; } else { $media = ''; } - $main = $GLOBALS['main_model']; - $path = $main->get_url('public/' . $name . '.' . $format, TRUE); + $path = Core::get_url('public/' . $name . '.' . $format, TRUE); $mime = __get_mime($format); return sprintf('<source type="%s" srcset="%s" %s>', $mime, $path, $media); @@ -45,8 +45,8 @@ function image( $height = NULL, $width = NULL, - $size = NULL, -) :string { + $size = NULL) :string +{ if ($animated === TRUE) { $animated = array('gif'); @@ -68,8 +68,7 @@ function image( } $format = end($formats); - $main = $GLOBALS['main_model']; - $path = $main->get_url('public/' . $name . '.' . $format, TRUE); + $path = Core::get_url('public/' . $name . '.' . $format, TRUE); $out .= "<img src=\"$path\""; if ($alt) { $alt = lang($alt); |