I have a user profile page in which the user loads his profile picture from the file dialog box.
when a file is moved to the local server folder, it only gets permission from 0644.
but I want to resize this image before uploading to the server ...
And for this I need permission like 0777 to edit it ...
How can I do it.
here is my code for moving and resizing
$upload_dir = './images'; $tmp = $_FILES["img"]["tmp_name"]; $names = $_FILES["img"]["name"]; $res=$moveR=move_uploaded_file($tmp, "$upload_dir/$names"); $a="./images/".$names; list($width, $height) = getimagesize($a); $newwidth = "300"; $newheight = "200"; $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($a); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb, $a, 100);
Thanks in advance.
source share