What you are seeing is probably a JavaScript timeout. If any JavaScript command 
takes too long then it will be aborted. 

There is a practical limit to the size of the image you can manipulate in this 
way, especially on a mobile device. 
How big is your image? In bytes?

Sent from my iPhone

On 2010-07-20, at 10:42 PM, Excell <[email protected]> wrote:

> With out the timeout, when it jumps to the next function dataURL
> ="data:," not dataURL="data:,/png;base64,iVBORw........etc",
> 
> so I assume it takes needs time to write the rest of the data string,
> 
> which makes it asynchronous behavior
> 
> Roger[Excell]
> 
> On Jul 21, 3:07 am, Jesse MacFadyen <[email protected]> wrote:
>> The call canvas.toDataUrl should be synchronous so your timeout would not be 
>> set until after the call had completed.
>> 
>> Have you observed asynchronous behavior?
>> 
>> Sent from my iPhone
>> 
>> On 2010-07-20, at 4:48 PM, Excell <[email protected]> wrote:
>> 
>>> I am having some success in achieving what my aim was using simple
>>> code.
>>> But I have one question
>> 
>>> I have had to use a setTimeout to wait for the canvas.toDataURL() to
>>> complete before saveing the data.
>> 
>>> This is not a great way to move forward as depending on the size of
>>> the image will change the amount of time i would need to set.
>> 
>>> Is there anyway to know when canvas.toDataUrl() is complete
>> 
>>> maybe I am coding this wrong
>> 
>>> Hope that makes sense
>> 
>>> <sample code below>
>>> function drawImage(img) {
>>>    var canvas = document.createElement("canvas");
>>>    canvas.width = img.width;
>>>    canvas.height = img.height;
>>>    var ctx = canvas.getContext("2d");
>>>    ctx.drawImage(img,0,0);
>>>    var dataURL = canvas.toDataURL();
>>>    setTimeout(insert(dataURL),2000);//delay enough for the canvas to be
>>> converted and save to local database
>> 
>>>    //insert(dataURL);
>>>    //this.cacheImageData(img.src, dataURL);
>>> }
>> 
>>> Thanks
>> 
>>> Roger[Excell]
>> 
>>> On Jul 16, 7:14 pm, Bill Humphries <[email protected]> wrote:
>>>> On Jul 16, 2010, at 11:08 AM, Jesse MacFadyen wrote:
>> 
>>>>> Here's how to get the data from an image.
>>>>> http://blogs.nitobi.com/jesse/2009/09/24/image-caching-with-the-html5...
>> 
>>>> Thanks, Jesse. That's much more succinct than my example. Bookmarkiing it.
>> 
>>>> -- Bill Humphrieshttp://whump.com
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "iPhoneWebDev" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/iphonewebdev?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "iPhoneWebDev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/iphonewebdev?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to