alapimba Posted October 12, 2009 Share Posted October 12, 2009 Hello I have a script to upload images, it works fine with small images, like 800x600 and so on. but if i go for 3000x2000 straight from my digital camera i got an error. Anyone has idea on whats going on? my errors: Warning: chmod() [function.chmod]: No such file or directory in /home/cocp/public_html/socios_uploadimg.php on line 28 Warning: getimagesize(img/socios/IMG_3607.JPG) [function.getimagesize]: failed to open stream: No such file or directory in /home/cocp/public_html/socios_uploadimg.php on line 29 Warning: Division by zero in /home/cocp/public_html/socios_uploadimg.php on line 30 Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/cocp/public_html/socios_uploadimg.php on line 39 Problem In Creating image my code: if ($_FILES['fotos_socios']['name'] == "") { echo "escolhe um file"; } else { $size = 150; // the thumbnail height $size2 = 480; // the thumbnail height $filedir = 'img/socios/'; // the directory for the original image $thumbdir = 'img/socios/thumb/'; // the directory for the thumbnail image $prefix = 'thumb_'; // the prefix to be added to the original name $prefix2 = 'big_'; // the prefix to be added to the original name $maxfile = '2000000'; $mode = '0666'; $userfile_name = $_FILES['fotos_socios']['name']; $userfile_tmp = $_FILES['fotos_socios']['tmp_name']; $userfile_size = $_FILES['fotos_socios']['size']; $userfile_type = $_FILES['fotos_socios']['type']; if (isset($_FILES['fotos_socios']['name'])) { $prod_img = $filedir.$userfile_name; $prod_img_thumb = $thumbdir.$prefix.$id_socio._.$userfile_name; move_uploaded_file($userfile_tmp, $prod_img); chmod ($prod_img, octdec($mode)); $sizes = getimagesize($prod_img); $aspect_ratio = $sizes[0]/$sizes[1]; if ($sizes[0] <= $size) { $new_width = $sizes[0]; $new_height = $sizes[1]; }else{ $new_height = $size; $new_width = abs($new_height*$aspect_ratio); } $destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image'); Link to comment https://forums.phpfreaks.com/topic/177399-upload-files-big-images/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 12, 2009 Share Posted October 12, 2009 The size of the file is probably larger than the upload_max_filesize setting and you are probably getting an upload error - http://www.php.net/manual/en/features.file-upload.errors.php Any upload script must check for upload errors before attempting to use any of the uploaded file information. Also, if you exceed the post_max_size setting, the $_FILES array will be empty, so you must actually check for that condition first, then check the ['error'] element of the $_FILES array for errors. Link to comment https://forums.phpfreaks.com/topic/177399-upload-files-big-images/#findComment-935392 Share on other sites More sharing options...
alapimba Posted October 12, 2009 Author Share Posted October 12, 2009 well i just increased my php.ini settings and it worked. memory_limit = 128M upload_max_filesize = 10M post_max_size = 20M Theres any bad thing about doing this? Is there any better way to upload images and faster than this move_upload comand? If i upload images usign picasa it's like 10 times faster then my webforms. whats the reason? Link to comment https://forums.phpfreaks.com/topic/177399-upload-files-big-images/#findComment-935407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.