Search Posts

Category: filesize

How to compress image size before uploading using php

I already searched lots of stuff, some of them are from stackoverflow. But none of them helped me. What I want to do is reduce the image file size, and after reducing the image will now be uploaded. Here’s my current code: <?php include ‘cloud_functions.php’; // GET THE USER’S ID $userid = _clean($con, $_POST[‘userid’]); if(!is_dir(“uploads/user/”.$userid.”/”)){ mkdir(“uploads/user/”.$userid.”/”, 0755); } $temp = explode(“.”, _clean($con,$_FILES[“file”][“name”])); $targetPath = “uploads/user/”.$userid.”/”; // RENAME THE IMAGE USING ROUND(); $newFN = round(microtime(true)) . […]