2015-12-24 8 views
7

Wie bekomme ich die Bild-URL aus dem rct-image-store? Ich habe das Bild mit ImageEditingManager zugeschnitten und es hat mir rct-image-store: // 0 zurückgegeben. Jetzt muss ich dieses Bild auf den Server hochladen. Wie bekomme ich die URL zu dem Bild, damit ich es hochladen kann? HierWie bekomme ich die Bild-URL von rct-image-store zum hochladen von Bild über api

ist der Code, den ich verwendet

ImageEditingManager.cropImage(
     photoURI, 
     transformData, 
     (croppedImageURI) => { 
      console.log('crop success', croppedImageURI); 
     }, 
     (cropError) => console.log('cropMyError', cropError) 
    ); 
    }, 
    (error) => undefined, 
); 

croppedImageURI angemeldet wird als

rct-Bild-Speicher: // 0

Wie bekomme ich die URL dieses Bild, damit ich es auf den API-Server hochladen kann?

Antwort

-2

var testDemo = React.createClass({ 
 
    getInitialState() { 
 
      return { 
 
       imageURISource: { 
 
        uri: 'http://facebook.github.io/react/img/logo_og.png' 
 
       } 
 
      } 
 
     }, 
 

 
     render: function() { 
 
      return (
 
       <View style={styles.container}> 
 
       <Image 
 
        style={{height:250,width:300, borderColor: '#f099f0',borderRadius:3}} 
 
        source= {this.state.imageURISource} 
 
        /> 
 

 
       ImageEditingManager.cropImage(
 
         photoURI, 
 
         transformData, 
 
         (croppedImageURI) => { 
 
           console.log('crop success', croppedImageURI); 
 
       
 
           //get croppedImageURI and set, it will update Image 
 
           this.setState({imageURISource: {uri:croppedImageURI}}) 
 
           
 
         }, 
 
         (cropError) => console.log('cropMyError', cropError) 
 
       ); 
 
        
 
      </View> 
 
      ); 
 
     }, 
 

 
});

+0

Können Sie beschreiben das Problem, das Sie haben und das Ergebnis erwartet? – Panda

Verwandte Themen