0
当我通过ajax使用$this->image_lib->crop()
调整图像大小或裁剪图像时,图像操作过程本身按预期工作。但是当我尝试使用$('#someDivId').css('background-image', 'url('+res.filepath+')');
显示生成的图像时,显示的图像未被裁剪。是因为ajax同步还是什么?请帮忙..ajax未检测到图像作物
P.S.我使用jQuery版本1.12.4和笨3
Ajax调用我用看起来像这样:
$.ajax({
url: '/mymodule/resize_img',
type: 'post',
data: $('form').serializeArray(),
dataType: 'json',
success: function(res) {
$('#someDivId').css('background-image', 'url('+res.filepath+')');
},
error: function(err) {
console.log(err.responseText);
}
});
我把它'res.filepath'指向正确(裁剪)的图像?您已通过在浏览器中直接打开它进行验证? –
@JaromandaX是的,没错 – dapidmini