# Camera crash everytime

**URL:** <https://forums.fusetools.com/t/camera-crash-everytime/533>\
**Category:** Bug Reports\
**Created:** [July 17, 2016, 5:37pm UTC](https://forums.fusetools.com/t/camera-crash-everytime/533 "2016-07-17T17:37:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [July 17, 2016, 5:37pm UTC](https://forums.fusetools.com/t/camera-crash-everytime/533/1 "2016-07-17T17:37:59Z")

</div>

hi, i’m facing an issue with camera module , its crashing everytime i press ok (to choose the picture) when i takepicture

```auto
function takePicture(){
    camera.takePicture().then(function(file){
      photo.value = file;
      Timer.create(function(){
      encodeImage(file)
    }, 300, false)
    }).catch(function(reason){
      console.log("loubou" + reason)
    })
}

function encodeImage(image){
  ImageTools.getBase64FromImage(image).then(function(ImageBase){
    picture.value = ImageBase;
    console.log("hey" + " " + JSON.stringify(ImageBase))
  })
}

```

this is the javascript and below the ux

```auto
        <Panel Height="100%" Alignment="Top" Row="0">
          <WhileCount Items="{photo}" EqualTo="1">
            <Image ux:Name="photo" File="assets/background/background.png" StretchMode="UniformToFill" >
              <DataBinding Key="photo" Target="photo.File" />
              <AddingAnimation>
                <Change photo.Opacity="1" Duration="0.5" />
              </AddingAnimation>
            </Image>
          </WhileCount>
          <WhileEmpty Items="{photo}">
            <Image ux:Name="backgroundImage" File="assets/background/background.png" StretchMode="UniformToFill">
              <RemovingAnimation>
                <Change backgroundImage.Opacity="0" Duration="0.5"/>
              </RemovingAnimation>
            </Image>
          </WhileEmpty>
        </Panel>

```

this is what my code looks like , anyone

---

<div class="post-metadata">

**Author:** ![Edwin\_Reynoso](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Edwin\_Reynoso](https://forums.fusetools.com/u/Edwin_Reynoso)\
**Post date:** [July 18, 2016, 12:10am UTC](https://forums.fusetools.com/t/camera-crash-everytime/533/2 "2016-07-18T00:10:21Z")

</div>

I think this should work but question why did you use the `Timer` module here?

---

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [July 18, 2016, 5:50am UTC](https://forums.fusetools.com/t/camera-crash-everytime/533/3 "2016-07-18T05:50:43Z")

</div>

But its not working , the app crash everytime `Timer` was just for testing no worry about it. so maybe an issue with my phone so?

---

<div class="post-metadata">

**Author:** ![Edwin\_Reynoso](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Edwin\_Reynoso](https://forums.fusetools.com/u/Edwin_Reynoso)\
**Post date:** [July 18, 2016, 8:34am UTC](https://forums.fusetools.com/t/camera-crash-everytime/533/4 "2016-07-18T08:34:00Z")

</div>

Try adding a `catch` to this part:

```javascript
function encodeImage(image){
  ImageTools.getBase64FromImage(image).then(function(ImageBase){
    picture.value = ImageBase;
    console.log("hey" + " " + JSON.stringify(ImageBase))
  })
}

```

and see what error is passed by logging it, and by the way what version are you on?

---

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [July 18, 2016, 9:04am UTC](https://forums.fusetools.com/t/camera-crash-everytime/533/5 "2016-07-18T09:04:22Z")

</div>

nothing to do with the encodeImage function , its somehting with the first function i think , because the process end at the moment when i take the picture. the app doesnt have the time to encode something, and i dont have any error in the console

---

<div class="post-metadata">

**Author:** ![\_Kobo](https://avatars.discourse-cdn.com/v4/letter/_/f05b48/32.png) [@\_Kobo](https://forums.fusetools.com/u/_Kobo)\
**Post date:** [July 19, 2016, 11:51am UTC](https://forums.fusetools.com/t/camera-crash-everytime/533/6 "2016-07-19T11:51:02Z")

</div>

After few test with other phones i can say that this is not a problem with fuse , but the phone itself , regarding the phone you are using a fuse app , some modules will fully work or not. Maybe some lowcost or middle cost phone will encounter this type of issue. my phone where the module crash is LG G4 Stylus, i’m using the last fuse version

regards

---

<div class="post-metadata">

**Author:** ![Anders\_Bondehagen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_bondehagen/32/98_2.png) [@Anders\_Bondehagen](https://forums.fusetools.com/u/Anders_Bondehagen)\
**Post date:** [July 20, 2016, 10:17am UTC](https://forums.fusetools.com/t/camera-crash-everytime/533/7 "2016-07-20T10:17:37Z")

</div>

Thanks Prince. We will try to get hold of a device like that and see if we can reproduce.
