Exception or error:
I am uploading images to my site using this function
$imagearray = json_decode($_POST['img']);
foreach($imagearray as $value){
$data = explode(',', $value);
$imagedata = base64_decode($data[1]);
$nam = genRandomString().'.jpeg';
$target_path='../uploads/'.$nam;
file_put_contents($target_path,$imagedata);
if($imgsname=="")
{
$imgsname=$nam;
$imgname=$nam;
}
else
{
$imgsname=$imgsname.','.$nam;
}
}
and then insert it into the database, I want to resize the images then insert them into the database, what is the easiest way to do this?
How to solve: