Facility Control

 View Only
  • 1.  Display Image(s) in Panel

    Posted 02-27-2024 09:39

    I would like to display a sponsor (PNG) image in my panel.  I have a file picker parameter and I can see the file path of the image.  I was hoping that once I selected an image, I could use the setStyle command to change the background image of a Dropspot area (or something else) to display this PNG file.



    ------------------------------
    Brian Bell
    Senior Real-Time Developer
    ESPN INC.
    Charlotte United States
    ------------------------------


  • 2.  RE: Display Image(s) in Panel

    Ross Staff
    Posted 02-29-2024 11:35
      |   view attached

    Hi Brian,

    To set a style to the preview of the image, you can use ogscript.setStyle() function.

    An example of using that function could be ogscript.setStyle('ImagePreview', 'bg-u:' + imageUrl);

    The above snippet sets the background of the label 'ImagePreview' to the selected image.

    For your reference, I have also attached a grid panel below that does exactly what you are looking for.

    Hope it helps.

    Best Regards,



    ------------------------------
    Altaz Daruwala
    Ross Video
    ------------------------------

    Attachment(s)

    zip
    image-chooser.zip   109 KB 1 version


  • 3.  RE: Display Image(s) in Panel

    Posted 03-04-2024 13:51

    Is there a method I can use that will remove the file:/ portion of the filename ?



    ------------------------------
    Brian Bell
    Senior Real-Time Developer
    ESPN INC.
    Charlotte United States
    ------------------------------



  • 4.  RE: Display Image(s) in Panel

    Ross Staff
    Posted 03-06-2024 12:49

    Hi Brian,

    To trim the file:/ part of the directory you can use the replace function to replace file:/ part of the directory with an empty string. You can find the example below:

             var trimmedDir = currentDir.replace(/^file:\//, '');
             ogscript.debug(trimmedDir);

    Hope it helps.

    Best Regards,



    ------------------------------
    Altaz Daruwala
    Ross Video
    ------------------------------



  • 5.  RE: Display Image(s) in Panel

    Ross Staff
    Posted 03-07-2024 10:13

    Hi Brian,

    Also, a better way to trim the 'file:/' part of the directory would be using the substr() method. You can use it as follows:

             var trimmedDir = currentDir.substr(6);
             ogscript.debug(trimmedDir);

    Hope this helps.

    Best Regards,



    ------------------------------
    Altaz Daruwala
    Ross Video
    ------------------------------



  • 6.  RE: Display Image(s) in Panel

    Posted 03-07-2024 11:00

    Thanks Altaz - that's what I ended up doing with some help from Chat GPT...



    ------------------------------
    Brian Bell
    Senior Real-Time Developer
    ESPN INC.
    Charlotte United States
    ------------------------------