I want to do is to resize every image to 300x300. My problem is in my current code some of the image file that was move to the upload folder are to big. I want all image file that is in the upload folder to be size 300x300.
current php code:
<?php
include_once('../dbc/database.php');
$db = new Connection();
$db = $db->dbConnect();
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$emailCodeResult = isset($_POST['emailCodeResult']) ? $_POST['emailCodeResult'] : "";
$imageLink = isset($_POST['imageLink']) ? $_POST['imageLink'] : "";
const path = "Oppa/upload/";
$s= explode(path,$imageLink);
unlink("../upload/".$s[1]);
$email = isset($_POST['email']) ? $_POST['email'] : "";
$type = $_FILES["imageInput"]["type"];
$ext = end(explode('/', $type));
$filename = uniqid() . '_' .$emailCodeResult . '.' . $ext;
move_uploaded_file($_FILES["imageInput"]["tmp_name"], "../upload/" . $filename);
$location = "Oppa/upload/" . $filename;
if(!empty($_POST['email'])) {
$q = "UPDATE tbl_user SET user_image = '$location' WHERE user_email= :email ";
$query = $db->prepare($q);
$query->bindParam(':email', $email);
$results = $query->execute();
echo "1";
}
?>