princeofpersia Posted December 13, 2010 Share Posted December 13, 2010 Hi guys, I have a simple code below which allows to me to upload image to a file directory and save the location of my file in database the only thing i dont understand is how to 1-resize the images 2- create a thumbnail while uploading 3- allow only jpeg & JPG files to be uploaded with 200kb max also, could you tell me what is the best size i can store the images in? thanks in advance //image1 $nameone=$_FILES['myfileone']['name']; $tmp_name= $_FILES['myfileone']['tmp_name']; if ($nameone) { $locationone="images/$nameone"; move_uploaded_file($tmp_name, $locationone); $image1 = mysql_query ("UPDATE user SET image1='$locationone'"); } Quote Link to comment Share on other sites More sharing options...
MMDE Posted December 13, 2010 Share Posted December 13, 2010 You should use these functions... http://php.net/manual/en/ref.image.php oh and they might need to be turned on in the php.ini file! Quote Link to comment Share on other sites More sharing options...
princeofpersia Posted December 13, 2010 Author Share Posted December 13, 2010 thanks but can you give me any example in code? im new in php Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 13, 2010 Share Posted December 13, 2010 example code(s) http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.