Subscribe to kiwi2's Blog        RSS Feed

An image to go!

Icon Leave Comment
Everybody wants to make quick and easy mobile applications, but "whoa", maybe you've got to know java atleast to get it going!. Well no, actually all you need is javascript, a little php and a bit of html, granted this does'nt work on a phone without a javascript enabled browser so two options exist build one(but then yo'll need to know a little more than javascript and php) or use a ready built one like, opera mobile which may be downloaded to almost any phone, allowing your application a fairly wide audience(I have'nt tested it on the iphone, somebody should).
This example will, in keeping with other entries on this blog, produce a very simple image, and "put" it on localhost via AJAX, please bear in mind that this example does not do anything fancy, but merely attempts to give you a few tools.
The method is the salient factor here since any realtime app could be constructed in this manner.
1.the php file to create a basic image.
2.the html file on localhost(mobile phone)
on your website
header("Content-type: image/png");
$width = $_GET[g];
$height = $_GET[p];
$na = $_GET[m];
$im = imagecreate($width, $height);
imagecolorallocate($im, 255, 255, 255);
imagepng($im, $na);


in a directory on your phone.
now the html, javascript & ajax
#for2{display: none;
position: absolute;
top: 40px;
left: 10px;
background-color: black;
color: white;
padding: 5px;
border: 1px solid blue;} 

position: absolute;
top: 250px;
left: 50px;
background-color: black;
color: white;
padding: 5px;
border: 1px solid blue;}

position: absolute;
top: 180px;
left: 50px;}
<script src='colors.js'></script>
var obj2;
var obj;

function ne() { 

obj2 = document.getElementById("for2"); = 'block';


function colim() 
var x =document.form3.width.value;
var y =document.form3.height.value;
var z;

obj = document.getElementById("for2"); = 'none';

var fep = null; 
("showim").innerHTML ='loading...';
fep = new XMLHttpRequest(); 
else if (window.ActiveXObject)
fet  = new ActiveXObject(Microsoft.XMLHTTP); 
fep.onreadystatechange = function()

if(fep.readyState == 4) 
if(fep.status == 200)

("ot").src = "" +;


document.getElementsById("showim").innerHTML ="Error: returned status code " + fep.status + " " + fep.statusText;
		};"GET", ""+x+"&&p="+y+"&&m="+z, true); 
		fep.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 

</script><body bgcolor='black'>
<input type='button' id='new' style='background-color: blue;' value='new' onclick='ne();' />

<div id='for2'><form name='form3'><b>Enter Width</b><br /><input type='text' id='width' /><br /><b>Enter Height</b></br><input type='text' id='height' /><br /><input type='text' id='name' /><br /><input type='BUTTON' name='submit' value='create new' style='background-color: blue;' onclick='colim();' /></form></div>
<div id='showim'></div><img src="" id='ot' />

Hope someone can do something with it.

0 Comments On This Entry


February 2018

18 19 2021222324


    Recent Entries

    Recent Comments

    Search My Blog

    0 user(s) viewing

    0 Guests
    0 member(s)
    0 anonymous member(s)