Photo Library access example

25 views
Skip to first unread message

jjoaquim

unread,
Feb 19, 2009, 10:58:06 AM2/19/09
to Big Five Safari iPhone Apps
Hello,

Does anyone has an example of a Photo Library access using BigFive?
I'm starting to use BigFive and would like to know if anyone could
share a code example for something like in the screencast.

Thanks,

ueilat

unread,
Mar 11, 2009, 9:29:09 AM3/11/09
to Big Five Safari iPhone Apps
after calling the standard procedure for activating big5

<div id="dev-photo"></div>
<a href="javascript:foto()">foto</a><br /><br /><br /><br />

<a href="javascript:camera()">camera</a><br /><br /><br /><br />


<scri pt>

function uploadCallback(){
$('dev-photo').innerHTML = '<img src="....image
position in your webserver....." style="border: 1px solid black; max-
width: 280px; max-height: 280px;" />'
}

function errorCallback(msg){
$('dev-photo').innerHTML = ""
alert(msg)
}

function cancelCallback(){
$('dev-photo').innerHTML = "Cancelled"
alert(msg)
}

function setLoading(text){
$('dev-photo').innerHTML = '';
}

function foto(){
setLoading();
Device.Image.getFromPhotoLibrary(
"...link to your webserver where is placed the script to receive
photo and to write to disk ...",
uploadCallback,
errorCallback,
cancelCallback);
}


function previewCallback(url){
Device.vibrate()
}

function camera(){
setLoading();
Device.Image.getFromCamera(
"...link to your webserver where is placed the script to receive
photo and to write to disk ...",
uploadCallback,
errorCallback,
cancelCallback);
}


</scri pt>


on the web server you can use the script from wiki for asp.net or I
developed for asp (after hours of work even if the solution was
easy... :-( )

"...link to your webserver where is placed the script to receive photo
and to write to disk ..."

<%

a=Request.TotalBytes

b=Request.BinaryRead(106)
b=Request.BinaryRead(a-106)



Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type =1
BinaryStream.Open
BinaryStream.Write b
BinaryStream.SaveToFile server.mappath("temp/temp.jpg"),2
%>

ueilat

unread,
Mar 12, 2009, 7:48:34 AM3/12/09
to Big Five Safari iPhone Apps
I made some modifications

b=Request.BinaryRead(a-106) must be b=Request.BinaryRead(a-106-21)

But in ASP, by default, there is a strong constrain. In fact the
maximum photo you can post is 200kb. To modify it you have to change
setup on server. Search on google for AspMaxRequestEntityAllowed

For avoid any proble you can use php
The script is
<?php
$fp= stripslashes($_POST['data']); //4 OK
file_put_contents("temp/temp.jpg",$fp,FILE_BINARY);

?>

Add stripslashes only if your php has been configured with
magic_quotes_gpc is on

With this script I posted without problem pictures of 1.6MB

Dirk Holtwick

unread,
May 4, 2009, 3:18:31 AM5/4/09
to big5...@googlegroups.com
Thanks, I've added the example to the wiki:

http://code.google.com/p/big5/wiki/ImageUpload

Dirk

ueilat schrieb:
Reply all
Reply to author
Forward
0 new messages