Resize image before uploading PHP

timsquid

New Member
I have no idea how to resize image in PHP, my code is:\[code\]for ($index = 1; $index <= 2; $index++) { if (!empty($_FILES["pic$index"]["name"])) { $ext = substr($_FILES["pic$index"]["name"], strrpos($_FILES["pic$index"]["name"], '.') + 1); $dir = "../gallery/$mkdir"; HERE I NEED THE RESIZE OF THE TMP FILE OF IMAGE move_uploaded_file($_FILES["pic$index"]["tmp_name"] , "$dir/img-$index.$ext"); } }\[/code\]$mkdir = the name of the gallery's folder (there are many galleries).$dir = where the pics will be placed.$ext = the type of the image (png, gif or jpg).foreach loop runs two times because you can upload two pics.This script is working good, I just need to do resize and I dont have an idea how to do it..
 
Back
Top