Saving Images to device and append

4 posts, 0 answers
  1. Keen
    Keen avatar
    101 posts
    Member since:
    Mar 2013

    Posted 18 Jun 2013 Link to this post

    Hi guys

         Hi does anyone know how to save images that I get from a site and get the image to specific div? Im using jquery mobile not kendo..im targeting iOs device.
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 18 Jun 2013 Link to this post

    Hi Keen,

    You can save an image from a URL via the Cordova File API's Filterable object (see here). A small sample for downloading an image using FileTransfer can be cloned and tested from here.

    About displaying it in a div, you might consider using the .prepend() method e.g.:

    $('#theDiv').prepend('<img id="img" src="<path_to_image>" />')

    Regards,
    Steve
    Telerik

    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Missed our first webinar, watch it here.
    Share feedback and vote for features on our Feedback Portal.
  3. Keen
    Keen avatar
    101 posts
    Member since:
    Mar 2013

    Posted 19 Jun 2013 Link to this post

    Hi Steve,

         Currently its working on device not on simulator. but anyways I just want to ask if its possible to specifically put a path? like it will go to photos. I'm using iPad, and if its not possible how to delete downloaded photos?
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 19 Jun 2013 Link to this post

    Hello Keen,

    Yes the File API is not yet supported in the Simulator and the sample would only work on a device.
    About your question - the download method of FileTransfer has a target/filePath parameter which allows you to specify the exact full path, refer to Cordova FileTransfer API for more information.

    Regards,
    Steve
    Telerik

    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Missed our first webinar, watch it here.
    Share feedback and vote for features on our Feedback Portal.
Back to Top