如何解决在图像路径后面更改数据-jQuery仅显示旧图像
| 想象一下您在Facebook上的个人资料。更改头像时,请选择一张新图片,对其进行裁剪,然后对其进行保护。之后,新的头像将显示在您的个人资料中。 我想在我的网站上提供相同的服务-一切正常。 但是:创建后(使用php),我无法立即显示新的and(!)裁剪的头像。我只能显示新的,但未裁剪的。刷新我的网站后,一切正常。 $(\“ div#button2 \”)。click(function(){//Thumbnail is created externally with php
//the name of the new cropped avatar is the same like the uncropped one
//i just change the picture,but the url is the same!
$.post(\"upload_thumbnail.php\",{
bild: bild,format: format,x: x,y: y,w: w,h: h
});
//delete the old avatar
$.post(\"upload_loeschen.php\",{
bild: bildalt
});
//save the url of the new cropped avatar in the database
$.post(\"upload_update.php\",laden_nr: \"1\"
});
//close my imageeditor
$(\"div#bildeditor\").hide();
jcrop_api.destroy();
$(\"#cropbox\").attr(\"src\",\"\");
$(\"#preview\").attr(\"src\",\"\");
//If there is a new avatar,display it!!! -> and here only the uncropped is displayed
if(bild != \"\") {
$(\"img#logo\").attr(\"src\",bild);
bild = \"\";
}
});
我只是不知道该网站如何显示未裁剪的头像,因为它不再存在。取而代之的是它。
非常感谢你!
本杰明
解决方法
问题是您的头像图片已被缓存,因此请尝试添加带有图片名称的随机参数
负载
var i=1;
在化身上改变i++;
然后设置the3ѭ
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。