01-27-2008 11:14 AM - edited 03-13-2019 04:54 PM
I would like to display a PNG-file embedded in a webpage on a CIPC or 797x. I know how to display one with <CiscoIPPhoneImageFile>, but this needs to be a directly adressable URL. Currently I grab the Image from the webpage by Inet1.GetURL, turn it into greyscale and resize it using CIPImage to a 132x65 image. This is usable on all the 794x/6x in our network. Using 797x and CIPC it would be nice to display the graphic in its full color and resolution. I ran into the SaveJPG and SavePNG functions of CIPImage, but did not find any detailed description on how to use these. I could then dump the image in a location everybody could access on the internal webserver. As a sideeffect this would reduce webtraffic to the original web-source as well.
Best regards
Patrick
02-01-2008 08:04 AM
The image choices come from PNG images and an XML file (called List.xml) that are stored on the
TFTP server used by the phone. By storing your own PNG files and editing the XML file on the TFTP
server, you can designate the background images from which users can choose. In this way, you can
provide custom images, such as your company logo.
02-01-2008 11:12 AM
Hi,
yes, I know how to display a PNG file on the phone or the background images. My question is how to save a dynamic graphic in a web-page onto disk with the SavePNG function of CIPImage. Then I can display it on the phone. Here is a sample snippet of my code which works with all 79xx phones, but this needs to scale down to 132x65 but I would like to modify this to display the better resolution PNG file on the CIPC/797x phone:
<%@ Language=JavaScript %>
<%
try
{
var tickersym=String(Request.QueryString("tsym"));
var serverIP = Request.ServerVariables("LOCAL_ADDR");
var d = new Date();
var hour = d.getHours();
var chartarray = new Array();
var Inet1 = new ActiveXObject("CiscoURLProxy.URLGrabber"); // Create the proxy object
var rawdata = Inet1.GetURL("http://ichart.yahoo.com/t?s="+tickersym, 1); // Get the gif from Yahoo... Note the "1" as the second parameter tells the component ByteArray. Its in the proxy doc...
var cip = new ActiveXObject("CIPIMAGE.ImageProcessor.1"); // Create my cip object
cip.LoadPNGFromBuffer(rawdata); // Load the byte array
var filnam = "c:\\ciscoipservices\\asp\\t.png" // Place to save graphic
cip.SavePNG(filnam); // <-- This is the part which I don't know how to make it work !!!!
cip.RGBToPalette(); // I don't know if the source is RGB or a palette so I to this anyway. It doesn't hurt...
cip.ColorToGray(); // reduce the colors to grayscale
cip.ReducePaletteColors(4); // reduce the palette to 4 colors. (2-bit)
cip.Resize(132,64);
var rawchartdata = cip.SaveCIPDataToBuffer();
Response.Buffer = true;
Response.ContentType = "text/xml"; // Don't forget the xml mime type header we all love...
// Display Array on screen
Response.Write("
Response.Write("
Response.Write("
Response.Write("
Response.Write("
Response.Write("");
Response.Write(rawchartdata+"");
// Display a File on CIPC screen
// Response.Write("
// Response.Write(tickersym+" Intra-day Chart
// Response.Write("
// Response.Write("
// Response.Write("");
Response.Flush(); // Flush by bufferd response
}
catch (err)
{
Response.Write("Error: " + err.description + ", " + err.number.toString(16)); // Yeah right, we won't have any errors....
}
Response.End();
%>
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: