I have this script that I am using that work to upload a file and to make sure the file is either jpg, jpeg, or gif. However, I want to restrict the user with the image width no larger than 150px. Is there an easy way to implement in the code I already have below?
if(isset($_POST['imageInsert']))
{
$current_image=$_FILES['image']['name'];
$imageextension = substr(strrchr($current_image, '.'), 1);
if (($imageextension!= "jpg") && ($imageextension != "jpeg") && ($imageextension != "gif"))
{
die('Unknown extension. Only jpg, jpeg, and gif files are allowed. Please hit the back button on your browser and try again.');
}
$time = date("fYhis");
$imagecaption = $_POST["imagecaption"];
$new_image = $imagecaption . "." . $imageextension;
$destination="../logos/".$current_image;
$action = copy($_FILES['image']['tmp_name'], $destination);
if (!$action)
{
die('File copy failed. Please hit the back button.');
}else{
After the else it is just MySQL code to insert the image into the database providing the extension is correct.
Any suggestions or tips? Thanks!