Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Open image editor/single image

$
0
0

i'm training to developing a test app to make photo or video. I've a single View, index.xml, and through which i can decide to make a photo or make a video.

<Alloy>
    <Window class="container">
        <TableView>
            <TableViewRow>
                <Label id="prompt">Cosa vuoi fare?</Label>
            </TableViewRow>
            <TableViewRow>
                <View id="promptButton">
                    <Button id="startpicture" onClick="doPicture">Foto</Button>
                    <Button id="startvideo" onClick="doVideo">Video</Button>
                </View>
            </TableViewRow>
            <TableViewRow>
                <ImageView id="image" top="20" height="100" borderColor="black" onClick="showPicture"></ImageView>
            </TableViewRow>
        </TableView> 
    </Window>
    </Alloy>
In my controller, index.js, i define the argument to pass to Titanium.Media.showCamera to make a photo, the function that i call in the index.xml, doPicture and a function showPicture, through which i would show the picture that i make. The other function, doVideo, are in beta version.
options = {
                    success : function(event) {
                        // l'operazione è andata a buon fine
                        if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
                            $.image.image = event.media;
                        }
                    },
                    cancel : function() {
                        // l'operazione è stata annullata
                    },
                    error : function(error) {
                        // si è verificato un errore
                        if (error.code == Titanium.Media.NO_CAMERA) {
                            alert("no available camera");
                        } else {
                            alert('errore ' + JSON.stringify(err));
                        }
                    },
 
                    saveToPhotoGallery : true
                };
 
    function doPicture(p) {
            Titanium.Media.showCamera(options);
    }
 
    function doVideo(v) {
        alert("Vuoi fare un video");
    }
 
    function showPicture() {
        Titanium.Media.openPhotoGallery(options);   
    }
 
    $.index.open();
With the showPicture function i would be able to open the image shown in the ImageView, not all the Gallery, only the editor. It's possible?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>