有没有人知道如何进行简单的图像上传并在页面上显示它.
这就是我要找的东西.
<img src>会做,因为我需要显示不同的图像大小.这是我的代码.(其中一些是编辑的,我从这里得到它)
<style>
/* Image Designing Propoerties */
.thumb {
height: 75px;
border: 1px solid #000;
margin: 10px 5px 0 0;
}
</style>
<script type="text/javascript">
/* The uploader form */
$(function () {
$(":file").change(function () {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = imageIsLoaded;
reader.readAsDataURL(this.files[0]);
}
});
});
function imageIsLoaded(e) {
$('#myImg').attr('src', e.target.result);
$('#yourImage').attr('src', e.target.result);
};
</script>
<input type='file' />
</br><img id="myImg" src="#" alt="your image" height=200 …Run Code Online (Sandbox Code Playgroud) 我有一个来自服务器的base64编码图像,我想通过JavaScript强制下载.有可能吗?