我正在使用JQuery上传和裁剪插件,可以在这里找到:
http://www.webmotionuk.co.uk/jquery/image_upload_crop.php
该代码可以正常运行,并且符合预期,但是我希望进行的一项更改是将保存的缩略图名称插入到mysql表中,但是由于某种原因,我无法使它正常工作。发布完整的代码实在太多了,所以我将尝试缩小范围:
updateavatar.php:
require("../db.php");
$avatar = mysql_real_escape_string($_POST['avatar']);
$email = mysql_real_escape_string($_POST['email']);
mysql_query("UPDATE admin SET avatar='".$avatar."' WHERE email='".$email."'");
任何帮助是极大的赞赏!
最佳答案
我从WebMotionUk收到此消息:
在脚本的1.2版中,大约在第246行(来自下载的原始文件)中,您将看到以下内容:
$cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale);
//Reload the page again to view the thumbnail
您需要做的就是直接在此行下方添加数据库插入/更新脚本。
因此,您应该具有以下条件:
$cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale);
mysql_query("UPDATE admin SET avatar='".$thumb_image_location."' WHERE email='".$email."'");
//Reload the page again to view the thumbnail
希望这可以帮助处于相同情况的任何人。