CardsImage

Image Card

This feature is only available in ESP-DASH Pro
Preview

A dashboard component that displays an image on your dashboard. Enables users to see an image directly on their dashboard.

Initializer

/* 
  Image Card
  Valid Arguments: (ESPDash dashboard, Card Type, const char* name, const char* size )
*/
Card card1(&dashboard, IMAGE_CARD, "Test Image", "lg");

Callback

💡

Image card doesn’t require any callback.


Updater

After initialization, you will have to provide the URL of the image which you want to display.

card1.update(const char* url);

Or you can also update the size of image using the second parameter. Supported sizes: lg and xl

// This will change the selected value and update the choices as well
card1.update(const char* url, const char* size);

Reference

This is a reference sketch showing positions for intializer and updater.

 
...
 
/* Image card initializer */
Card image(&dashboard, IMAGE_CARD, "Test Image", "lg");
 
 
void setup() {
  ...
 
  /* Image card updater - can be used anywhere (apart from global scope) */
  image.update("https://fastly.picsum.photos/id/598/800/600.jpg?grayscale&hmac=SQ5T_OGiPMX4r1fb-gA2fU6pourJEfxmTz7g1HfXOSk");
}
 
void loop() {
  ...
}
 
Copyright © 2024 Softt. All rights reserved.