php - JCrop cropping the wrong area -


i need implementation of jcrop. tried follow manual whenever select area, it's not selecting have selected. instead it's taking area outside selection. sometimes, it's taking area (i thinking because of photo size) it's taking wrong area. please help. here's code:

note $photo uploaded image. it's being uploaded no issue on that.

the 120 x 120 pixels want save uploaded pictures save storage space. also, here's css of <img> element display image cropping:

max-width: 100%; height: auto; display: inline-block; position: relative;     

here's php code:

$twidth = 120; $theight = 120; $quality = 90; $src = imagecreatefromjpeg($photo); $dst = imagecreatetruecolor($twidth, $theight); $x = $_post['x']; $y = $_post['y']; $w = $_post['w']; $h = $_post['h']; imagecopyresampled($dst, $src, 0, 0, $x, $y, $twidth, $theight, $w, $h); imagejpeg($dst, $photo, $quality); 

the problem here resizing image box css. creating difficulties script find correct area. instead should limit box width/height jcrop function below:

$('#cropbox').jcrop({         boxwidth: 480,   //maximum width want bigger images         boxheight: 480,  //maximum height bigger images ... }); 

if use jcrop setting take wanted area, otherwise not working expected.

best wishes


Comments

Popular posts from this blog

c# - Class in a list -

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

Jdbc Odbc Driver error -