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?
var imgWidget = new Image("app", "SonusPhoneLogoTest.png", 0, 0, 205,51);
digium.app.idleWindow.add(imgWidget);
var imgWidget = new Image("app", "SonusPhoneLogoTest.png", 0, 0, 105,0);
digium.app.idleWindow.add(imgWidget);
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.
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:
var imgWidget = new Image("app", "SonusPhoneLogoTest.png", 0, 0, 0,0);
imgWidget.resize(205,51);
digium.app.idleWindow.add(imgWidget);
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.
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?