Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Saving a photo #55

Open
guglovich opened this issue Aug 1, 2022 · 13 comments
Open

[Feature] Saving a photo #55

guglovich opened this issue Aug 1, 2022 · 13 comments

Comments

@guglovich
Copy link

Please make the option to save photos to the catalog. I understand that now they are stored in the system folder. I would like to choose my own folder.

@TGHepburn
Copy link

Yes Please, I'd like this feature too! Love the App

@DeMoN100
Copy link

DeMoN100 commented Dec 1, 2022

Yes there is no save option & when trying to use Save on Device to try to save something I just get a blank file with 0 bytes. I thought it was their app so i submitted an issue but they told me it's because of your apps MIME generation its something you must fix within the vector camera app. Don't abandon this software.

@lmj0011
Copy link

lmj0011 commented Dec 6, 2022

but they told me it's because of your apps MIME generation

That's not the issue.

This Stackoverflow answer provides insight into the root cause of the actual issue.

I did a little debugging and this is what I found...

The app has a method that tries to index the files to make them accessible to other apps, I think because the images and videos from the app are being stored in private app specific storage, it's conflicting with this method.

It would be best if the MediaStore API was used for saving images/videos, it would eliminate the need for apps like SaveTo and SaveOnDevice altogether

ref: 1

@lmj0011
Copy link

lmj0011 commented Dec 6, 2022

@dozingcat

I'm currently working on a PR that should resolve issues 1, 2.

The plan is to update PhotoLibrary.kt to start saving Images and Videos inside the DCIM directory using the MediaStore API so files are freely accessible outside of the app for all users using Android 10+

The directory structure will look like this:

/**
 * Directory structure:
 *
 * // if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
 * [app-directory]/
 *     thumbnails/
 *         [image_id].jpg
 *         [video_id].jpg
 *     metadata/
 *         [image_id].json
 *         [video_id].json
 *     raw/
 *         [image_id].gz
 *         [video_id]_video.dat
 *         [video_id]_audio.pcm
 *     VectorCamera_images/
 *         [image_id].png
 *     VectorCamera_videos/
 *         [video_id].webm (if exported)
 *     tmp/
 *         [video ID of recording in progress]_video.dat
 *         [video ID of recording in progress]_audio.pcm
 *
 * // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
 *  [app-directory]/
 *     thumbnails/
 *         [image_id].jpg
 *         [video_id].jpg
 *     metadata/
 *         [image_id].json
 *         [video_id].json
 *     raw/
 *         [image_id].gz
 *         [video_id]_video.dat
 *         [video_id]_audio.pcm
 *     tmp/
 *         [video ID of recording in progress]_video.dat
 *         [video ID of recording in progress]_audio.pcm
 * [mediaStore]/
 *     DCIM/
 *         VectorCamera/
 *               Images/
 *                  [image_id].png
 *               Videos/
 *                  [video_id].webm
 *
 */

I'm estimating this will take me about 1-2 weeks months to complete, assuming I don't run into any roadblocks. In the meantime, until I submit the PR, you can keep up with my progress here.

@lmj0011
Copy link

lmj0011 commented Dec 6, 2022

@DeMoN100 @TGHepburn @guglovich

Are you all running Android 10 or higher?

I just want to confirm that the issue of not being to accessible media files outside of the app is exclusive to non-rooted Android 10+ devices

@DeMoN100
Copy link

DeMoN100 commented Dec 7, 2022

@DeMoN100 @TGHepburn @guglovich

Are you all running Android 10 or higher?

I just want to confirm that the issue of not being to accessible media files outside of the app is exclusive to non-rooted Android 10+ devices

Yes that is correct I am on android 12.

@TGHepburn
Copy link

TGHepburn commented Dec 7, 2022

No, I'm on an older android, version 8. I can get to the folder..when I remember where it is ( l know a prompt comes up giving directory but I miss it half the time).

I'd just like to choose where they are placed in settings for app

@dozingcat
Copy link
Owner

@lmj0011 thanks for looking into this. Your approach sounds good and I'll be happy to review your PR.

@lmj0011
Copy link

lmj0011 commented Dec 7, 2022

@TGHepburn

Please make the option to save photos to the catalog. I understand that now they are stored in the system folder. I would like to choose my own folder.

This issue is kinda asking for 2 seperate things, I plan on handling the first one. Images and Videos will get saved in the DCIM/VectorCamera directory by default (tentatively, only for users running Android 10+). I suppose this could be expanded on later to allow the user to select their own directory. I will likely leave that for someone else to handle since I'm trying to avoid altering the UI if possible

@guglovich
Copy link
Author

@DeMoN100 @TGHepburn @guglovich

Are you all running Android 10 or higher?

I just want to confirm that the issue of not being to accessible media files outside of the app is exclusive to non-rooted Android 10+ devices

I have Android 12.1 with Root

@lmj0011
Copy link

lmj0011 commented Dec 15, 2022

Here's my (work in progress) PR: #56

I've reached a roadblock with trying to save videos into mediaStore, to therefore make them accessible in the public DCIM directory. The video saves, but it's basically unplayable. It appears the effects are not actually part of the video file but instead applied in real time whenever the video is played from the app.

My work on this feature is at an end, since there needs to be more code rewriting done than I'm willing to contribute my spare time to. Hopefully my PR is a good starting point for @dozingcat or another contributor.

@dozingcat
Copy link
Owner

#58 should allow "Save on device" to work.

@dozingcat
Copy link
Owner

@lmj0011 Thanks for your work! The next release will be out shortly and will update to the current API level 33, still using private app storage. After that I'll see if it's possible to use MediaStore based on your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants