I'm using imgAreaSelect to select image area. I have following values.
Need Help to upload original image to "../original-images/" folder & cropped images to "../uploads/" folder.
Upload cropped images with new filename "$newfilename"
Plz help
Thanks in advance.

    $x1
    $y1
    $x2
    $y2
    $w
    $h

    $filename = $_FILES["image"]["name"];
    $file_basename = substr($filename, 0, strripos($filename, '.')); // get file extention
    $file_ext = substr($filename, strripos($filename, '.')); // get file name
    $newfilename =time().rand(11,99). md5($file_basename) . $file_ext;
            $filename = $_FILES["image"]["name"];               
            $x1 = $_POST['x1'];         
            $y1 = $_POST['y1'];     
            $x2 = $_POST['x2'];             
            $y2 = $_POST['y2'];     
            $w = $_POST['w'];           
            $h = $_POST['h']; 

            $target_dir = "../uploads/"; 
            $path = "../original-images/"; 

            $jpeg_quality = 100;

            $file_basename = substr($filename, 0, strripos($filename, '.')); // get file extention

            $file_ext = substr($filename, strripos($filename, '.')); // get file name

            $target_file = time() . rand(11, 99). md5($file_basename)  . $file_ext; //rename file and add extention

Help please...

No code there for cropping the image. What have you tried? Here is the manual page from php.net for imagecrop(): http://php.net/manual/en/function.imagecrop.php

And yes, Google (or DuckDuckGo) is your friend!

Member Avatar for diafol

Use pathinfo() to get the extension, not the DIY script.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.