You can put any file name in the image-provider's DATA column
("_data").

As long as your image is in the image-provider, other gallery apps
will see your image.

If you don't add the image yourself
(getContentProvider().insert(...)), then the MediaScanner will do this
for you when it's run (upon remount of your SD or Phone storage).

Note that using MediaStore.Images.Media.EXTERNAL_CONTENT_URI only
allows for inserting/handling images on your SD-card. Any phone
without an SD card (many HTC Incredibles, for example) won't run your
app properly.


On Jun 30, 1:18 am, Julian <lepin...@gmail.com> wrote:
> Thanks (belatedly) for your reply. For the time being I've stuck with
> manually writing my images to /sdcard/DCIM/AppName, which may or may
> not be the best solution. I haven't yet checked to see if
> getContentProvider().insert allows you to specify the DCIM
> subdirectory, but my guess is no. (Which is disappointing if my guess
> is right, because the directory hierarchy and the Gallery app both
> seem to be purpose-built for exactly that.)
>
> I'm quite happy writing my image files manually, provided that:
> - this is not strongly frowned upon, and
> - i can figure out a way to force gallery to refresh from the
> filesystem (this may be the sticking point)
>
> Any thoughts?
>
> On Jun 21, 7:18 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
>
>
>
> > Compress (Bitmap.compress) the image yourself into a file.
> > Then use the
> > getContentProvider().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, 
> > ....)
> > to insert your image into the database/content-provider.
>
> > When inserting, you can create a ContentValues name-value pair with
> > MediaStore.MediaColumns.DATA for the name and the fully qualified file-
> > path to the image for the value.
>
> > On Jun 20, 11:16 pm, Julian <lepin...@gmail.com> wrote:
>
> > > So from what I can tell Media.insertImage is locked to heavy
> > > compression on all images. This includes when passing in the path to a
> > > photo in the filesystem. As a test I used a 3000x2000 pixel jpg which
> > > had been previously saved at maximum quality and was ~6MB. After
> > > passing the path to Media.insertImage, the resultant copy (still
> > > 3000x2000) is 623KB.
>
> > > I passed in another copy of the 3000x2000 image, this one compressed
> > > down to 393KB. After Media.insertImage, the image filesize is 492KB.
>
> > > I'm wondering if there's a way to specify the compression when images
> > > are saved by insertImage.
>
> > > I'm also wondering why this is recompressing jpgs, rather than simply
> > > copying them intoDCIM. A side-effect of opening and re-compressing
> > > these images is that it imposes a rather low VM cap on what
> > > insertImage can handle. I'm getting out-of-memory errors when trying
> > > to pass the path of a 10 megapixel image.
>
> > > As an aside: are there any problems with a developer creating their
> > > own file/folder structure underDCIM? Is this frowned upon?
>
> > > Thanks for any thoughts,
>
> > > Julian- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to