1

Facebookであなたのプロフィールを想像してみてください。アバターを変更するときは、新しい写真を選択し、トリミングしてから保存します。その後、新しいアバターがプロフィールに表示されます。

私のウェブサイトでは、同じサービスを提供したいと考えています。これはすでに機能しています。

しかし:私は(phpで)それを作成した直後に新しいand(!)トリミングされたアバターを表示することができません。新しいものしか表示できませんが、トリミングされていません。サイトを更新した後、すべてが正常に機能します。

$("div#button2").クリック(関数() {

//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", { bild: bild, 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 = ""; } });

トリミングされていないアバターがサイトに表示される方法がわかりません。もう存在しないからです。それはトリミングされたものに置き換えられました。

どうもありがとうございました!

ベンジャミン

4

1 に答える 1

1

問題は、アバターの写真がキャッシュされたことです。そのため、画像名にランダムなパラメーターを追加してみてください

ロード時var i=1;
アバターi++;
の変更と設定img src ="imgpath?random="+i

于 2011-06-11T14:52:19.450 に答える