ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\UI\examples\Image\Responsive Namespace Reference

Functions

 base ()
 

description: > Base example for rendering a responsive Image. More...

 
 with_additional_high_resolution_source ()
 

description: > Example for rendering a responsive image with additional high resolution sources. More...

 

Function Documentation

◆ base()

ILIAS\UI\examples\Image\Responsive\base ( )


description: > Base example for rendering a responsive Image.

expected output: > ILIAS shows a rendered image. While changing the size of the browser window the image will

decrease in size bit by bit. If the element gets analyzed a text entry for "alt" is shown within the HTML.

Definition at line 33 of file base.php.

References $DIC, Vendor\Package\$f, and $renderer.

34 {
35  //Loading factories
36  global $DIC;
37  $f = $DIC->ui()->factory();
38  $renderer = $DIC->ui()->renderer();
39 
40  //Genarating and rendering the image
41  $image = $f->image()->responsive(
42  "assets/ui-examples/images/Image/HeaderIconLarge.svg",
43  "Thumbnail Example"
44  );
45  $html = $renderer->render($image);
46 
47  return $html;
48 }
$renderer
global $DIC
Definition: shib_login.php:22

◆ with_additional_high_resolution_source()

ILIAS\UI\examples\Image\Responsive\with_additional_high_resolution_source ( )


description: > Example for rendering a responsive image with additional high resolution sources.

expected output: > Example showing different card sizes which use an image with additional high resolution sources. The selected version of the image depends on the space available, meaning that the large image version is displayed on very large screens (even if the browser does not use the entire screen width). On very small screens, the small image version is displayed. The effect is best seen on desktop devices: Open the browser's developer tools ("Inspect" or F12). Select a screen width (very small, medium, large, extra-large) one after the other, reload the page each time and check the image source (img src) of the image. Depending on the screen width, different versions of the image are loaded

here (144w, 301w, 602w, original).

Definition at line 42 of file with_additional_high_resolution_source.php.

References $DIC, and $renderer.

42  : string
43 {
44  global $DIC;
45  $factory = $DIC->ui()->factory();
46  $renderer = $DIC->ui()->renderer();
47 
48  $image = $factory
49  ->image()
50  ->responsive('assets/ui-examples/images/Image/mountains-144w.jpg', 'Mountains')
51  ->withAdditionalHighResSource('assets/ui-examples/images/Image/mountains-301w.jpg', 100)
52  ->withAdditionalHighResSource('assets/ui-examples/images/Image/mountains-602w.jpg', 300)
53  ->withAdditionalHighResSource('assets/ui-examples/images/Image/mountains.jpg', 500);
54 
55  $card = $factory->card()->standard('Mountains', $image);
56 
57  // render each card individually so every image has a different id.
58  return
59  '<div style="width: 100%; display: flex; justify-content: space-between">' .
60  '<div style="width: 49%;">' . $renderer->render($card) . '</div>' .
61  '<div style="width: 30%;">' . $renderer->render($card) . '</div>' .
62  '<div style="width: 19%;">' . $renderer->render($card) . '</div>' .
63  '</div>';
64 }
$renderer
global $DIC
Definition: shib_login.php:22