php image crop උදව්වක් ඕනේ

Casinoboy

Well-known member
  • Jun 6, 2011
    5,244
    2,682
    113
    php image crop උදව්වක් ඕනේ

    මචන්ලා php Jcrop වලින් crop කරන පින්තුරයක් ඩවුන්ලොඩ් කරන්‌නේ ‌කොහොමද ? ම‌ේ ‌කා්‌ෙඩ් ඒකෙන් ‌සේව් ‌ව‌ෙනවා ක‌ොහොමද ඩවුන්ලෝඩ් කරන්නේ ඉම‌ේජ් ඒක


    PHP:
    	$file = $_GET['file'];
    	
    	$location = 'upload/'.$file;
    	$newFile = time().'_'.$file;
    	$newloc = 'upload/'.$newFile;
    	
    	$targ_w = $targ_h = 250;
    	
    	$img_r = imagecreatefromjpeg($location);
    	$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
    
    	imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
    	$targ_w,$targ_h,$_POST['w'],$_POST['h']);
    
    	imagejpeg($dst_r, 'upload/'.$newFile);
     

    SaNDun

    Well-known member
  • May 4, 2006
    12,690
    838
    113
    In La Srinka
    PHP:
        $file = $_GET['file'];      
        $location = 'upload/'.$file; 
        $newFile = time().'_'.$file; 
        $newloc = 'upload/'.$newFile; 
         
        $targ_w = $targ_h = 250; 
         
        $img_r = imagecreatefromjpeg($location); 
        $dst_r = ImageCreateTrueColor( $targ_w, $targ_h ); 
     
        imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'], 
        $targ_w,$targ_h,$_POST['w'],$_POST['h']); 
    
    
        header('Content-Type: image/jpeg');     
         header('Content-Disposition: attachment; filename="'.$newFile.'";');
         imagejpeg($dst_r);
     
    Last edited: