hey guys, i wanted the pictures to resize when i use the photo upload php code, but unfortuantely couldnt do it.. is there anybody that could help me? the code is as below, the picture height is to be max 240, width max 320, is there a possibility of making it smaller at this ratio? $randomsayi = rand(1,11515454745484410); $file = $_FILES['file2']; $useradi = $_POST['username']; $usergadi = $_POST['gercekadi']; $categories = $_POST['categories']; $file_n = $_FILES['file2']['name']; $file_name = "$file_n-$randomsayi.jpg"; $file_size = $_FILES['file2']['size']; $file_temp = $_FILES['file2']['tmp_name']; $bad_files = "0"; $max_size = "10048576"; $extensions = ".gif$|.png$|.jpg$"; if ($file) { if ($file_size > $bad_files) { if ($file_size <= $max_size) { if (ereg($extensions , $file_name)) { if (move_uploaded_file($file_temp, "files_uploaded/$myusername/$file_name")) { $sql = "insert into $categories (foto1,foto1oy,categories,tanim,isim,uname,isimi) values ('/files_uploaded/$myusername/$file_name','0','$categories','$tanim','$isim','$useradi','$usergadi')"; $kayit = mysql_query($sql); echo "<td valign=top width=350><center><img class='resssim' src='/files_uploaded/$myusername/$file_name' alt='' name='sa' id='sa' /><br><br></center></td>"; }else{ print "<font color=\"red\" font size=\"3\">System error!</font></P>\n"; } }else{ print "<font color=\"red\" font size=\"3\">unknown extension </font><p>\n"; print "File name: $file_name<p>\n"; } }else{ print "<font color=\"red\" font size=\"3\">the file is too large</font><p>\n"; } }else{ print "<font color=\"red\" font size=\"3\">File Must Be Greater Than 0 Byte's</font><p>\n"; } } Code (markup):
below are some useful urls you can use http://www.weberdev.com/get_example-3938.html http://www.theopensurgery.com/29/php-upload-and-resize-image-script/ http://9lessons.blogspot.com/2009/03/upload-and-resize-image-with-php.html