I am using the JQuery upload and crop plugin which can be found here:
http://www.webmotionuk.co.uk/jquery/image_upload_crop.php
The code works fine and as expected but the one change I wish to make is to insert the saved thumbnail name into a mysql table but for some reason I can't get this to work. It wo开发者_如何学运维uld be too much to post the full code so I will try and narrow it down:
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."'");
Any help is greatly appreciated!
I received this message from WebMotionUk:
On version 1.2 of the script, on approximately line 246 (of the original file from the download) you should see this:
$cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale);
//Reload the page again to view the thumbnail
All you need to do is to add your database insert/update script directly below this line.
Therefore you should have the following:
$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
Hope this helps anyone in the same situation.
精彩评论