2014년 11월 27일 목요일

Pictures/Photos Project, is it possibile...?


my idea is basically something that permit me to take load photos from the phone, than assign some tags/category to the selected photos... And at the end permit me to search and querying photos by category/tags and show me the result.

Is it possible to do with appinventor2?

Could you explain me the summary logic of the component i should use in order to build this app?

-- 

Be aware, the AI2 Camera control is buggy, difficult to use, stores images under 'random' names that have to be saved into a List and accessed by a TinyDB.    

AI2 has no capability of examining the contents of a folder (the File control, which one would expect could find a file without knowing its name, presently can not).  Therefore, it is impossible to grab an image file by name, unless you know the name and file path.

In order to build your described app, try Eclipse, Android Studio or commercial tools like Basic4Android (not very expensive).

AI2 is NOT a professional compiler.    It is great to have fun with, but its capabilities are limited.

--
yes you can


as a start, see this snippet https://puravidaapps.com/snippets.php#2share     
share.aia

just store the path to the taken image or the picked image in a list and your tags in a second list (if there is more than one tag for an image, this will be a list of lists), then store both lists in TinyDB


the image picker can only pick 10 images, therefore you might want to use this alternative solution with the activity starter How to pick an image using the activity starter
for searching your tags comfortably, let me suggest to store the tags for each image in a fusiontable
see the tutorial Pizza Party with Fusion Tables for App Inventor 2 for how to work with fusiontables

try something and have fun! there are more things possible than some people think...

first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn App Inventor

--
As Taifun's note indicates, what you can do related to your projected app is VERY limited.  What it can not do is take random images from your phone; it is only going to work as he describes with images you take with the broken Camera control.

--
As Taifun's note indicates, what you can do related to your projected app is VERY limited.
probably there is a misunderstanding?
what I was saying is, that the project is doable, I can't see any limitations for this project

What it can not do is take random images from your phone

... the broken Camera control
there are issues with the camera component and some devices, see here camera not working w/ASUS TF101 
and https://code.google.com/p/app-inventor-for-android/issues/detail?id=2035
and for other devices the camera component works fine...
or are there also other issues with the camera component I'm not aware of?

--
Help with project fix - Front camera  Camera not able to use front camera on some devices.

Camera is not select-able using the component on at least some devices with both forward and rear cameras - controls do not work on my devices..reported months ago.

Known camera (or other component) issues are NOT documented in the MIT component documentation.  MIT will get around to this one day...documentation is sadly out of date.   Here is a MIT staff comment " Not sure if a workaround should go into documentation. I think until it gets fixed, it would be the PowerUsers to recommend the workaround. What do you think? "    

A useful Camera object would have:

1) Ability to list the files in any directory AI2 captures an image from Camera, Canvas, File (especially) and Web ..the controls that 'capture' images.
2) Ability to select any of the items (images) in the list in #1 from within AI2.
3) Ability to DELETE any of the items in the list in #1 from within AI2
4) images should go in the DCIM folder or have it as an option
5) take and manipulate image within AI2, not using kludges and external paid for apps.

AI2's component has NONE of these features without elaborate work around...yeah, some of this is possible.     Perhaps you will provide a tutorial?

The point is, what is the point of the AI2 camera control as it NOW stands?    Camera is only slightly better than the AI2 screen layout controls/placement routines.

The point here is AI2 is NOT a professional tool.  AI2 REQUIRES kludges (gimmicks) to do lots of stuff other compilers do routinely.  Have fun with AI2, it is a powerful tool for someone who has no clue how to code in Java.  Be aware, AI2 is supporting a small cottage industry of people who provide 'fixes' for a fee.   Nothing wrong with users charging for services for AI2 toys that do not exist or are 'broken.'

For the adventurous, here is some code to reproduce Taifun's  camera picture taking app... It still might work..

public void TakePicture() {

    Date date = new Date();

    String state = Environment.getExternalStorageState();

    if (Environment.MEDIA_MOUNTED.equals(state)) {

     Log.i("CameraComponent", "External storage is available and writable");

      imageFile = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),

       "/Pictures/app_inventor_" + date.getTime()

        + ".jpg"));


      ContentValues values = new ContentValues();

      values.put(MediaStore.Images.Media.DATA, imageFile.getPath());

      values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");

      values.put(MediaStore.Images.Media.TITLE, imageFile.getLastPathSegment());


      if (requestCode == 0) {

        requestCode = form.registerForActivityResult(this);

      }


      Uri imageUri = container.$context().getContentResolver().insert(

        MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);

      Intent intent = new Intent(CAMERA_INTENT);

      intent.putExtra(CAMERA_OUTPUT, imageUri);

     // NOTE: This uses an undocumented, testing feature (CAMERA_FACING).

      // It may not work in the future. --sorry I lost the attribution.


--
ok, I see, the front camera feature does not work, also not on my Nexus 5... 
A useful Camera object would have:
actually 1-3 are File component requirements...
1) Ability to list the files in any directory AI2 captures an image from Camera, Canvas, File (especially) and Web ..the controls that 'capture' images.
unfortunately it is not possible to get a list of files...
yes, this would be a great enhancement of the File component
2) Ability to select any of the items (images) in the list in #1 from within AI2.
see this solution 
3) Ability to DELETE any of the items in the list in #1 from within AI2
you can do this with the File component and the File.Delete method

Delete(text fileName)
Deletes a file from storage. Prefix the filename with / to delete a specific file in the SD card, for instance /myFile.txt. will delete the file /sdcard/myFile.txt. If the file does not begin with a /, then the file located in the programs private storage will be deleted. Starting the file with // is an error because assets files cannot be deleted.

4) images should go in the DCIM folder or have it as an option
agreed
5) take and manipulate image within AI2, not using kludges and external paid for apps.
yes, image manipulation would be nice to have
further requirements from my point of view: take an image programmatically without user intervention

--
Thanks both for your point of view... My main idea was "just" an application that takes photos from the gallery and give me the capability to assign one or more tags to the photos and then give me the capability to do some research... For example... I'm looking for a new jacket, i go in some shop, i take photos of the jackets, then i would open the photos, and tag it for category,color,prize,model etc... Then i would have a search field based on the tags...

--
Alfo, you have two suggestions.  Either would give you the ability to do some of what you want to do.  Try some blocks and ask a specific question.
At the moment, your questions are indicating you do not know very much about programming, database etc.
I suggest you do the Tutorials:
and read the  AI2 free online eBook   http://appinventor.mit.edu/explore/ai2/tutorials.html   ... the links are at the bottom of the Web page.
and when you know more,
Do these tutorials and read this other documentation  
You have to code the project, so use AI2 (with its limitations) or learn Java and do everything like a professional.  It is up to you.

--
i have already read some documentation tried some tutorials and built some example app, i would just be sure that this project is feasible and i would to be addressed in the right way in order to avoid loss of stupid time in useless components or similar stuffs... Anyway thank you, i think that all yours and Taifun answers could be useful for my project.

--

댓글 없음:

댓글 쓰기