我使用jQuery fancybox作为弹出窗口在我的应用程序中显示上传的图像。我上传图片的代码如下:
改变照片
<div class="change-photo" style="min-height:250px;">
<div class="current-photo">
<span>Current Photo</span>
<img src="getProfilePic.html?userid=${sessionScope.user.userId}" height="100px" width="100px" border="0" class="img" /></div>
<div class="upload-photo">
<p><span>Upload Photo</span></p>
<p>You can upload a JPG or PNG file (File size limit is 4 MB).</p>
<p><input type="file" NAME="file" onchange="checkSize(this);" /></p>
<p > <font style="color:red;">${message}</font></p>
<p class="dot-line"> </p>
<input type="submit" value="" class="upload-photo-but" /> or
<a class="cropImage {width:1024,height:675}" href="uploadPhoto.html"></a>
<a href="javascript:history.back();"><b>Cancel</b></a>
</div>
</div>
</div>
</div> I am using a form submission to a controller which is used to display the uploaded image for cropping. <FORM ENCTYPE="multipart/form-data" METHOD="POST">
我的fancybox脚本如下
$("#cropImage").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'overlayColor' : '#333',
'hideOnOverlayClick' : false,
'type' : 'iframe',
'hideOnContentClick' : true,
'onClosed': function() { parent.location.reload(true); },
'onComplete' : function() {
$('#fancybox-frame').load(function() { // wait for frame to load and then gets it's height
$('#fancybox-content').height($(this).contents().find('body').height()+30);
});
}
});
我无法在弹出窗口中显示上传的图像。在对代码进行一些细微的更改后,我会弹出异常或弹出相同的jsp来上传图像。
提前致谢