I sort of made an image cropping tool
select an image to crop, submit the form, crop the image, save and the cropped image appeasrs below.
But the image is totally black?
Heres the PHP bit t o save the cropped image
$t_width = 300; // Maximum thumbnail width
$t_height = 300; // Maximum thumbnail height
$new_name = "feature.jpg"; // Thumbnail image name
$path = "../providers/images/{$_GET['id']}/";
if(isset($_GET['t']) and $_GET['t'] == "ajax")
{
extract($_GET);
$ratio = ($t_width/$w);
$nw = ceil($w * $ratio);
$nh = ceil($h * $ratio);
$nimg = imagecreatetruecolor($nw,$nh);
$im_src = imagecreatefromjpeg($path.$img);
imagecopyresampled($nimg,$im_src,0,0,$x1,$y1,$nw,$nh,$w,$h);
imagejpeg($nimg,$path.$new_name,90);
echo $new_name;
exit;
}
Doo you see what the problem could be?
when I echo out
$nimg = imagecreatetruecolor($nw,$nh);
I get Resource id #1
but when I echo $im_src, I get nothing
what does that mean?