idleWindow with Image

Community based support for the Digium Phone Application Programming Interface (API).

Moderators: jwitt, sruffell, malcolmd, Moderator

idleWindow with Image

Postby jfulfordtdn » Tue Jun 30, 2015 9:39 am

I'm attempting to add a custom idle window image. This image would override the default image defined in the extension settings.

I'm using a PNG image at 205x51 pixels. If I set this image as the default phone background under admin settings, the image displays correctly.

If I attempt to add this same image to the app idle window, it doesn't fit. I've tried multiple different ways to define the correct image dimensions, but nothing works, the image will always be cropped.

Is there something that could be causing this that is not defined in the Phone API Wiki?

Also, why would specifying image dimensions NOT work when adding the image to the app Idle window? Both of the snippets below produce the exact same result. Why does setting image properties have no actual bearing on the image?

Code: Select all
         var imgWidget = new Image("app", "SonusPhoneLogoTest.png", 0, 0, 205,51);
   digium.app.idleWindow.add(imgWidget);

Code: Select all
         var imgWidget = new Image("app", "SonusPhoneLogoTest.png", 0, 0, 105,0);
   digium.app.idleWindow.add(imgWidget);
jfulfordtdn
Newsterisk
 
Posts: 12
Joined: Wed Dec 10, 2014 9:13 am

Re: idleWindow with Image

Postby sruffell » Tue Jun 30, 2015 11:46 am

It looks like you are correct. I was not able to change the size of an Image by changing the 'h' and 'w' parameters to the Image constructor.

Looking at the underlying implementation in the application engine, it appears that the height and width of the image always comes from the dimensions in the image file itself.

It works properly when setting as the default phone background since that is not handled by the application engine.

Is it possible for you to resize the actual png before installing on the phone?

I agree the documentation needs to be changed or the bug in the code fixed.
sruffell
Oldsterisk
 
Posts: 200
Joined: Fri Jan 07, 2011 2:02 pm

Re: idleWindow with Image

Postby sruffell » Tue Jun 30, 2015 12:33 pm

An update:

There appears to be an undocumented function for images that allow you to resize them. The h/w attributes of the base widget do not appear to resize Images.

So you might be able to do something like this:

Code: Select all
var imgWidget = new Image("app", "SonusPhoneLogoTest.png", 0, 0, 0,0);
imgWidget.resize(205,51);
digium.app.idleWindow.add(imgWidget);
sruffell
Oldsterisk
 
Posts: 200
Joined: Fri Jan 07, 2011 2:02 pm

Re: idleWindow with Image

Postby jfulfordtdn » Tue Jun 30, 2015 12:49 pm

The image is actually already sized to be 205x51. So it should be showing the same way as the default image set through the extension settings page.

Also, the resize image function also doesn't appear to work. Tried the code below and it still crops off the image.
jfulfordtdn
Newsterisk
 
Posts: 12
Joined: Wed Dec 10, 2014 9:13 am

Re: idleWindow with Image

Postby sruffell » Tue Jun 30, 2015 1:03 pm

Strange, are you perhaps putting another widget on top of your image then?

Can you provide your complete application and I can run it here?
sruffell
Oldsterisk
 
Posts: 200
Joined: Fri Jan 07, 2011 2:02 pm


Return to Digium Phone API

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest