开发者

JQuery - Upload Crop & Save To MySQL Database

开发者 https://www.devze.com 2023-03-19 04:19 出处:网络
I am using the JQuery upload and crop plugin which can be found here: http://www.webmotionuk.co.uk/jquery/image_upload_crop.php

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消