Dynamic Images, dynamic URL?

TrikinCurtTrikinCurt Junior MemberPosts: 158
Is it possible to have a button with an image (jpg) where the URL itself changes? Basically I am getting back something like:

Artist=Billy Joel
Songname=Always a Woman to Me
Coverart=http://www.foo.com/coverart/billyjoel/album.jpg

How do I put that covertart on a G4 panel? It seems so simple, but all I know how to do is a dynamic image, not a dynamic URL!

Curt
Trikin

Comments

  • Joe HebertJoe Hebert Junior Member Posts: 2,154
    You can change the properties of a dynamic image at runtime with the ^RMF SEND_COMMAND to your TP and then refresh the dynamic image with a ^RFR.
    Dynamic Image Commands

    "'^BBR-<vt addr range>,<button states range>,<resource name>'"
    Set the bitmap of a button to use a particular resource.

    "'^RSR-<resource name>,<refresh rate>'"
    Change the refresh rate for a given resource (in seconds).

    "'^RFR-<resource name>'"
    Force a refresh of the given resource.

    "'^RAF-<resource name>,<data>'"
    Add a new resource. Add any and all resource parameters by sending
    embedded codes and data. See below for embedded codes.

    "'^RMF-<resource name>,<data>'"
    Modifiy an exisiting resource. Modify any and all resource parameters
    by sending embedded codes and data. See below for embedded codes.

    Embeded Codes

    '%P<0-1>' Set Protocol (HTTP =0, FTP = 1)
    '%U<user>' Set Username for authentication
    '%S<password>' Set Password for authentication
    '%H<host>' Set Host name (fully qualified DNS or IP address)
    '%A<path>' Set Image file path
    '%F<file>' Set Image name
    '%R<refresh 0-65535>' Set Refresh rate (in seconds)
    '%N<0-1>' Set newest file ( A value of 1 means that only the
    most recent file matching the pattern is downloaded)
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    I've been doing this with a cover art modification to the Escient-provided module. The ^RFR command isn't necessary. Once you change the URL with ^RFM, the image updates on it's own.
  • rfmoylerfmoyle Junior Member Posts: 12
    problems with ^RMF command

    I tried to use the ^RMF commands recently for a camera switching app using an AXIS 241Q video server. Even though I was 100% certain I was putting in the path and file the way I had used it in the resource manager when I tested it, I could not get it to work. The test program is short, so I'll post it. I worked with Gary in Tech support, eventually he came up with a workaround using the ^BBR command, so its all good, but I would still like to know why the heck it didn't work the way I first tried it, or how you guys might suggest troubleshooting it. I kind of suspect something with the arguments at the end of the filename is hosing it, tried $3f for ?, samo for = , didn't get anywhere. Any insights much appreciated.
    Bob Moyle
    PROGRAM_NAME='testmotionjpeg'
    DEFINE_DEVICE
    camerasTP1   = 10001:12:0	 // camera page/port
    camerasTP2   = 10002:12:0
    
    DEFINE_CONSTANT
    CHAR CAMS[5][20]=
    {
             {'^BBR-6,0,cam1'},
    	 {'^BBR-6,0,cam2'},
     	 {'^BBR-6,0,cam3'},
    	 {'^BBR-6,0,cam4'},
    	 {'^BBR-6,0,quad'}
    }
    /*----------------------------------
     * this is what I wanted to do
    
    CHAR CAMS[5][80]=
    {
             {'^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi?camera=1&resolution=704x480'},
    	 {'^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi?camera=2&resolution=704x480'},
     	 {'^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi?camera=3&resolution=704x480'},
    	 {'^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi?camera=4&resolution=704x480'},
    	 {'^RMF-axis-cams,%Amjpg/quad%Fvideo.mjpg'}
    }
    ---------------------------------------------*/
    
    CAMERA1 = 1
    CAMERA2 = 2
    CAMERA3 = 3
    CAMERA4 = 4
    QUAD    = 5
    
    DEFINE_VARIABLE
    
    CHAR CURRENT_CAM[80]
    VOLATILE dev camPANELS[]={camerasTP1,camerasTP2}
    VOLATILE INTEGER camBUTTONS[]={CAMERA1,CAMERA2,CAMERA3,CAMERA4,QUAD}
    
    DEFINE_MUTUALLY_EXCLUSIVE
    ([camerasTP1,CAMERA1]..[camerasTP1,QUAD])
    ([camerasTP2,CAMERA1]..[camerasTP2,QUAD])
    
    DEFINE_EVENT
    
    BUTTON_EVENT[camPANELS,camBUTTONS]
    {
        PUSH:
    	{
    	        stack_var integer idx
    		stack_var dev panel
    		idx=get_last(camBUTTONS)
    	       CURRENT_CAM=CAMS[idx]
                    idx=get_last(camPANELS)
    		panel=camPANELS[idx]
    	       SEND_COMMAND panel, CURRENT_CAM
    		ON[panel,idx]
    	}
    }
    
    DEFINE_PROGRAM
    
    (***********************************************************)
    (*                     END OF PROGRAM                      *)
    (*        DO NOT PUT ANY CODE BELOW THIS COMMENT           *)
    (***********************************************************)
    
    
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    The ^RMF command assigns the file, path etc., to the dynamic image, and the the ^BBR command assigns the dynamic image to the button. My guess is your panel file didn't assign the dynamic image to the button in the first place,so it needed to be done in code.
  • rfmoylerfmoyle Junior Member Posts: 12
    Dave,

    Thanks for the reply. The button I was using for the dynamic image had 'axis-cams(dynamic)' assigned to it.

    Bob
  • Joe HebertJoe Hebert Junior Member Posts: 2,154
    rfmoyle wrote:
    I kind of suspect something with the arguments at the end of the filename is hosing it, tried $3f for ?, samo for = , didn't get anywhere.
    If you want to encode the ? mark in a URL then you need to use a % (not $) followed by two hex digits. So the ? mark should be replaced with %3F and not $3F. At least that?s the standard for URL encoding. I?m not sure if will work though since the embedded codes in the ^RMF command also use a % sign but it may be worth a shot.

    You mentioned that you?re 100% certain of the file and path. How about the IP? You can embed it in your ^RMF command with %H.
  • rfmoylerfmoyle Junior Member Posts: 12
    I meant that instead of
    '^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi?camera=1&resolution=704x480'
    I tried
    "'^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi',$3f,'camera',$3d,'1&resolution',$3d,'704x480'"
    I didn't try sending the %P or %H values, they were already set correctly in the resource, my understanding of this command is you only modify the fields you need to.

    thanks,
    Bob Moyle
  • Joe HebertJoe Hebert Junior Member Posts: 2,154
    rfmoyle wrote:
    I tried"'^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi',$3f,'camera',$3d,'1&resolution',$ 3d,'704x480'"
    I was thinking along the lines of:

    "'^RMF-axis-cams,%Aaxis-cgi/mjpg%Fvideo.cgi%3fcamera%3d1&resolution%3d704x480'"
    rfmoyle wrote:
    ...my understanding of this command is you only modify the fields you need to.
    That?s correct, I was just trying to cover all the bases.
  • ondrovicondrovic Junior Member Posts: 217
    Having an issue with ^RMF-

    I am having an issue with the ^RMF- command here is what I have but the image isn't updating any ideas?
    
    sWeather.sIconAddy = 'http://us.yimg.com'
    sWeather.sIconPath = '/i/us/nws/weather/gr/'
    sWeather.sIcon = '4d.png'
    
    Send_Command dvTP,"'^RMF-w_icon,%H',sWeather.sIconAddy,'%A',sWeather.sIconPath,'%F',sWeather.sIcon"
    

    TIA
  • jjamesjjames AMX Sustaining Engineer Posts: 2,898
    Try removing [url]http://.[/url] By default it's already HTTP.
  • ondrovicondrovic Junior Member Posts: 217
    jjames wrote: »
    Try removing [url]http://.[/url] By default it's already HTTP.

    tried it both ways but no luck the dynamic image is never updating
  • Spire_JeffSpire_Jeff Formerly Caffeinated Programmer Posts: 1,917
    This is a stupid question, but one I have had to answer no to.... are there any other images that are working? If not, have you made sure that the gateway and DNS addresses are set on the touch panel?

    Jeff
  • ondrovicondrovic Junior Member Posts: 217
    Spire_Jeff wrote: »
    This is a stupid question, but one I have had to answer no to.... are there any other images that are working? If not, have you made sure that the gateway and DNS addresses are set on the touch panel?

    Jeff

    Not a stupid question my DHCP settings were not providing dns settings. I changed it to static. Will let you know if that fixes it
  • ondrovicondrovic Junior Member Posts: 217
    That fixed it LOL and to think I have been beating myself up thinking it was a coding issue. Thanks Jeff
  • Spire_JeffSpire_Jeff Formerly Caffeinated Programmer Posts: 1,917
    No problem, I've done the same thing myself :)

    Jeff
Sign In or Register to comment.