Advertisement
fahmihilmansyah

compres image from bas364

Dec 6th, 2018
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1.  
  2.     function saveImg($base64_img=''){
  3.         $newimg = base64_decode($base64_img);
  4.         $im = imagecreatefromstring($newimg);
  5.         $nameimg = uniqid(). '.jpg';
  6.         $file = realpath('../file_bukti')."/" . $nameimg ;
  7.         if ($im !== false) {
  8.             imagejpeg($im,$file,65);
  9.             imagedestroy($im);
  10.         }
  11.         return array('img_name'=>$nameimg,'img_path'=>$file);
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement