mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
webui: Added auto width and height dimensions parameters to generic image dashboard widget (#8314)
Added the ability to substituted special parameters for width and height of the Generic-image widget to be added to an Image URL.
This commit is contained in:
@@ -67,3 +67,12 @@ In the dashboard, you want to create an interface graph select the widget called
|
||||
* Note: you can map the port by description or the alias or by port id. You will need to know this in order to map the port to the graph.
|
||||
|
||||

|
||||
|
||||
### Dimension parameter replacement for Generic-image widget
|
||||
|
||||
When using the Generic-image widget you can provide the width and height of the widget with your request.
|
||||
This will ensure that the image will fit nicely with the dimensions if the Generic-image widget.
|
||||
You can add @AUTO_HEIGHT@ and @AUTO_WIDTH@ to the Image URL as parameters.
|
||||
Examples:
|
||||
+ http://librenms.example.com/graph.php?id=333%2C444&type=multiport_bits_separate&legend=no&absolute=1&from=-14200&width=@AUTO_WIDTH@&height=@AUTO_HEIGHT@
|
||||
+ http://example.com/myimage.php?size=@AUTO_WIDTH@x@AUTO_HEIGHT@
|
||||
|
@@ -57,6 +57,12 @@ if (defined('SHOW_SETTINGS') || empty($widget_settings)) {
|
||||
</form>';
|
||||
} else {
|
||||
$widget_settings['title'] = $widget_settings['image_title'];
|
||||
if (strstr($widget_settings['image_url'], '@AUTO_HEIGHT@')) {
|
||||
$widget_settings['image_url'] = str_replace('@AUTO_HEIGHT@', $widget_dimensions['y'], $widget_settings['image_url']);
|
||||
}
|
||||
if (strstr($widget_settings['image_url'], '@AUTO_WIDTH@')) {
|
||||
$widget_settings['image_url'] = str_replace('@AUTO_WIDTH@', $widget_dimensions['x'], $widget_settings['image_url']);
|
||||
}
|
||||
if (strstr($widget_settings['image_url'], '?')) {
|
||||
$widget_settings['image_url'] .= "&".mt_rand();
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user