Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Saved image is not displayed in Gallery — Gideros Forum

Saved image is not displayed in Gallery

DanhanfryDanhanfry Member
edited November 2014 in Bugs and issues
Hello good, sorry for my English, I'm making a simple app which takes care of downloading an image using URLLoader

Everything works properly.

local out = io.open("|D|image" .. Estension, "wb")
out:write(event.data)
out:close()
MiTextura = Texture.new("|D|image" .. Estension)
b = Bitmap.new (MiTextura)

The image loads properly and looks perfect. But I did a work to download the image to Mobile (ANDROID)

local out = io.open("/sdcard/Download/newImage.jpg", "wb")
out:write(ImageData)
out:close()

The implementation works well. But then when I go to Galeria no picture, now comes the most curious.

The picture is in the gallery when you restart the phone (android) is something very rare.

Any normal app, you save images, these images appear when the gallery.

If I go to the file browser if you see but watch. Only appears if I search from the mobile. If I connect the phone to the computer and look for the image in the sdcard / Download / nothing appears directory.

I hope you can help me. Thank you.

Comments

  • really, I need help.
  • there might be problems on mobile with lower/uppercase and exchanging "/" and "\" in file names and paths. this may or may not help you.

    Likes: Danhanfry

    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    @Danhanfry for android you need to call a broadcast event to reindex specific directory to display pic at the gallery.
    //let media scanner scan it
    Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
    File f = new File(destination);
     
    Uri contentUri = Uri.fromFile(f);
    mediaScanIntent.setData(contentUri);
    sActivity.get().sendBroadcast(mediaScanIntent);
    You can use media plugin to manipulate pictures in such way:

    https://github.com/gideros/giderosplugins/blob/master/Media

    Likes: Danhanfry

    +1 -1 (+1 / -0 )Share on Facebook
  • @Danhanfry for android you need to call a broadcast event to reindex specific directory to display pic at the gallery.
    //let media scanner scan it
    Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
    File f = new File(destination);
     
    Uri contentUri = Uri.fromFile(f);
    mediaScanIntent.setData(contentUri);
    sActivity.get().sendBroadcast(mediaScanIntent);
    You can use media plugin to manipulate pictures in such way:


    Really thank you very much, I've gotten is with the Media plugin. Really thanks
Sign In or Register to comment.