cs1h Posted January 11, 2008 Share Posted January 11, 2008 Hi, I have a script that creates a smaller image of an original (and keeps the original as well) when it is uploaded. But it can only process pictures below two mega bites, even if I increase the maxfile size in the script. Does anyone know how to make it so that it can process larger images? The script is, <?php if(isset($_POST['Submit'])) { $size = 600; // the thumbnail width $filedir = 'images/'; // the directory for the original image $thumbdir = 'images/'; // the directory for the thumbnail image $prefix = 'small_'; // the prefix to be added to the original name $maxfile = '200000'; //maximum file size to upload $mode = '0666'; $userfile_name = $_FILES['image']['name']; $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $userfile_type = $_FILES['image']['type']; if (isset($_FILES['image']['name'])) { $prod_img = $filedir.$userfile_name; $prod_img_thumb = $thumbdir.$prefix.$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_width = $size; $new_height = abs($new_width/$aspect_ratio); } $destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image'); $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image'); ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, $new_width, $new_height, $sizes[0], $sizes[1]) or die('Problem In resampling'); ImageJPEG($destimg,$prod_img_thumb,90) or die('Problem In saving'); imagedestroy($destimg); } print_r($sizes); echo"width new: $new_width<br>height new: $new_height"; echo ' <br><a href="'.$prod_img.'"> <img src="'.$prod_img_thumb.'" width="'.$new_width.'" heigt="'.$new_height.'"> </a>'; }else{ echo ' <form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data"> <input type="file" name="image"><p> <input type="Submit" name="Submit" value="Submit"> </form>'; } Thanks, Colin Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted January 11, 2008 Share Posted January 11, 2008 give us a link to a file that has <?php phpinfo(); ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted January 11, 2008 Share Posted January 11, 2008 you need to change your ini file ; Maximum allowed size for uploaded files. upload_max_filesize = 2M and maybe this one memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) and maybe this ; Maximum size of POST data that PHP will accept. post_max_size = 8M Quote Link to comment Share on other sites More sharing options...
nikefido Posted January 11, 2008 Share Posted January 11, 2008 give us a link to a file that has <?php phpinfo(); ?> i wouldn't go displaying that to the public... Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted January 12, 2008 Share Posted January 12, 2008 phpinfo doesn't have any private info in it its simply configurations 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.