Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Capturing an image and placing it directly into an image control?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Capturing an image and placing it directly into an image control?

    Hi all,

    I'm playing around with phonegap and Alpha, and one of the things I've been trying to do is take a picture on an android tablet and immediately place it into an image control.

    I have a button on the UX with an 'Image Capture' action javascript event. As expected, this opens up the camera, I take a picture, and the camera closes, but does nothing.

    I have tried the following lines...

    Code:
    $('IMAGE_1').src = e.data;
    As well as.../

    Code:
    $('IMAGE_1').src = e.fileSystemURL;
    But nothing seems to work. I even tried putting js alerts in there so at least I have something to help me debug, but nothing seems to be working. I made sure to select all plug-ins related to file system and camera in the build, as well as making sure that photos are cordova/phonegap, as opposed to HTML5.

    Anyone know what I'm missing?

    Thanks in advance

    #2
    Re: Capturing an image and placing it directly into an image control?

    Do you mean that you're using the "Image Capture - Camera/Photo Library" Action?

    If so, then in that Action, at the top of it's dialog, you have a property named "Javascript to execute when image has been capture". Is this where you're running your code?

    If so, then you need to access the "element" of your control. You won't have an HTML Id named "IMAGE_1"... but rather a rendered <img> tag with the Id most likely being...

    Code:
    DLG1.V.R1.IMAGE_1
    The inline help, in this case, is a bit misleading... or at best... confusing. If you added a Static Text Control, and defined HTML for that control as an <img> tag and set your own Id... then your code would have worked.

    However, since you're using an an Image control, you must first get a pointer to that control... then sets its source...

    Code:
    var imgEle = {dialog.Object}.getPointer('IMAGE_1');
    imgEle.src = e.data;

    Comment


      #3
      Re: Capturing an image and placing it directly into an image control?

      Hi David,

      So yeah, I put the javascript in that action you mentioned, tried using both pointers to the control, as well as using

      Code:
      document.getElementById('{dialog.ComponentName}.V.R1.IMAGE_1').src = e.data;
      The issue is still the same though, the image does not appear on the screen. Perhaps I'm going about this the wrong way?

      Thanks again!

      Comment


        #4
        Re: Capturing an image and placing it directly into an image control?

        Can you post your UX? What you've posted looks ok. Something else is going on.

        What version/build of Alpha are you using?

        Comment


          #5
          Re: Capturing an image and placing it directly into an image control?

          CameraComponent.a5wcmp

          I've attached the component...I'm on version 12.4.5.2, build 5018


          It seems to work fine when I do it on web/live preview, but putting it through the phoneGap build seems to kill the functionality.
          I added an alert with an inline action to see if any part of that event is firing, and it is, which is nice. I just don't understand why the image doesn't want to appear


          Thanks again!

          Comment


            #6
            Re: Capturing an image and placing it directly into an image control?

            The problem isn't really in your Javascript code... although you are assigning .src twice and you do not need to. You also don't need the long form of document.getElementById... unless you really want it.

            You can do either...

            Code:
            $('{dialog.ComponentName}.V.R1.IMAGE_1').src = e.data;
            or

            Code:
            $('{dialog.ComponentName}.V.R1.IMAGE_1').src = e.fileSystemURL;
            The problem is most likely in the missing plugins for your PhoneGap Build app. When working with the camera I include these plugins...

            Code:
            Camera
            Device
            File
            File Transfer
            Geolocation
            Network Information
            Notification
            ImagePicker
            Whitelist
            You're probably missing Device... which, if not there, will stop everything. Turning on Debugging in your Device, and then attaching your device to your PC and debugging through Chrome... you'd see the errors in the console.

            Comment


              #7
              Re: Capturing an image and placing it directly into an image control?

              Yep, I was missing Device. I checked it off and it worked liked I hoped it would've.
              Thanks so much!

              Comment


                #8
                Re: Capturing an image and placing it directly into an image control?

                Attaching your device through the PC and using chrome to debug it - how is that done? Is there any sort of how to on that anywhere? It seems simple enough. I always just put it on an a5w page and debug that way in chrome, how do you see your device? Is it in AS? Or do you mirror the device? Interesting and probably off topic for this thread but it would be pretty cool to know. Can this be done with an iPad as well?
                Thanks for pointers on the plugins! Seems like a lot of them are needed. I guess the next question is there any documentation to help us figure out what plugins might be needed?
                NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                Comment


                  #9
                  Re: Capturing an image and placing it directly into an image control?

                  Google search for Android debugging... that'll get you the information you need. You can't debug PhoneGap Build using an a5w page. Debugging iOS is certainly possible, but not under Windows... you'll need a Mac.

                  Comment


                    #10
                    Re: Capturing an image and placing it directly into an image control?

                    Ah, the Mac I got. I bought it awhile back for like 60 bucks. It’s an older one but got me the stuff I needed for the provisioning files and stuff you need for an iOS app.
                    Your right though I have not researched it. I’ll look into it. Thanks for the heads up. I understand I cannot debug a PGB but most of the issues I would create for myself can be found in the UX in chrome as it is mostly dumb stuff like a missing image/bad path or locating and sizing containers. I find it pretty easy to adjust widths and immediately see the changes that way. Then I jump into AS and make the changes I want.
                    With so many aspects to a successful build it is easy to see why app development can be expensive if you want it done right! Even with all the fast and efficient AS features!
                    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                    Comment


                      #11
                      Re: Capturing an image and placing it directly into an image control?

                      Jan, be aware that a version beyond 4770 will completely mess you up due to undocumented changes in the way that Alpha renders a Static Image Control.

                      In 4770 you get an <img> tag with the Id you assigned.

                      Beyond 4770 (I don't know when it started) your Static Image Control is now wrapped in a <div> and that div is assigned your Id. This means that your code which works in 4770 will fail silently and without console error in a release after 4770. The div will get your src assignment and your Image control will remain empty. This is one of those bugs that consumes all the time Alpha saved you in the first place.

                      Comment


                        #12
                        Re: Capturing an image and placing it directly into an image control?

                        Originally posted by Davidk View Post
                        Jan, be aware that a version beyond 4770 will completely mess you up due to undocumented changes in the way that Alpha renders a Static Image Control.

                        In 4770 you get an <img> tag with the Id you assigned.

                        Beyond 4770 (I don't know when it started) your Static Image Control is now wrapped in a <div> and that div is assigned your Id. This means that your code which works in 4770 will fail silently and without console error in a release after 4770. The div will get your src assignment and your Image control will remain empty. This is one of those bugs that consumes all the time Alpha saved you in the first place.
                        Hmm okay, this is good to know, thank you for the help!

                        Comment

                        Working...
                        X