2016-11-25 3 views
3

HTML에 jpg/png 이미지를 표시하려고합니다. 서버에서 Base64 문자열을 얻고 있습니다. HTML에서 다음과 같이 표시하고 있습니다 :Base64 이미지의 Angular2 net :: ERR_UNKNOWN_URL_SCHEME

<md-card> 
    <md-card-content> 
    <img id="uploadPicture" class="uploadPicture" [src]="'data:image/jpg;base64,' +file_src "> 
    </md-card-content> 
    <md-card-actions> 
    <input id="uploadedFile" type="file" #fileInput (change)="chooseImage(fileInput.files)"/> 
    <button md-raised-button color="primary" [disabled]="isUploaded" (click)="uploadPicture(fileInput.files)">{{'upload picture' | translate}}</button> 
    <button md-raised-button color="primary" [disabled]="isRemoved" (click)="removePicture()">{{'remove picture' | translate}}</button> 
    </md-card-actions> 
</md-card> 

PUT URL을 사용하여 그림을 업로드하면 정상적으로 작동합니다.

순 :: ERR_UNKNOWN_URL_SCHEME 내가으로도 경고를 얻고있다

:

경고 : 안전하지 않은 살균을 나는 그것이 GET API를 사용하여 다운로드하려고하지만, 그 같이 나에게 오류를 제공

012 : URL 값은

나는 아래로 내 구성 요소에 소독제를 사용

하지만 작동하지 않았습니다. 누군가가 쟁점이 될 수 있다고 말해 줄 수 있습니까?

+0

효과가있었습니다. 이 오류가 계속 발생해도 이미지를 볼 수 있습니다. 나는 그것을 제거했다면 (this.file_src! = '') 체크. –

답변

0

이미지를 업로드 할 때 http : \ 또는 https : \를 base64string에 추가하십시오.

관련 문제