Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. $img = str_replace(array('data:image/png;base64','data:image/jpeg;base64','data:image/jpg;base64','data:image/gif;base64'), null, $img);
  2. $img = base64_decode($img);
  3. $imgurl = 'image_' . substr(md5($img), 0, 24) . mt_rand(0, 100000) . $type;
  4.  
  5. create_dir_functions($dir);
  6.  
  7. $dir[2] = $dir[1] . '/' . $imgurl;
  8.  
  9. file_put_contents( $cdir . $dir[2], $img);
  10.  
  11. return $dir[2];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement