Jump to content

garydt

Members
  • Posts

    321
  • Joined

  • Last visited

    Never

Everything posted by garydt

  1. Thanks i did that and i got upload done Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2200 bytes) in /homepages/3/d209077294/htdocs/uplodsmalpic2.php on line 135
  2. just tried it and 3 failed! What does that mean?
  3. No, the memory_get_usage() line never executed or showed any additional error message. Thanks very much, MadTechie. I can see it should b working, i can't understand why my script doesn't always work I added the lines - ini_set('memory_limit', '500M'); set_time_limit ( 0 ); and i still get server error 500 or it says its not a jpeg when i try and upload/resize a large image. here's most of my script in case you spot something i've got wrong. Upload form- <form name="form1" id="Upload" action="<?php echo $editFormAction; ?>" enctype="multipart/form-data" method="POST"> <p> <input type="hidden" name="MAX_FILE_SIZE" value="2000000000"> </p> <h3> <input name="file" type="file" id="file" onchange="MM_showHideLayers('Layer1','','hide')" /> <span class="style1">for your photo</span> </h3> <p> <label> <input name="sent" type="hidden" id="sent" value="1" /> </label> </p> <h3 class="style7"> <input type="text" name="textfield" /> <span class="style2 style1">Add caption for the photo</span> </h3> <input name="submit" type="submit" id="submit" onclick="MM_showHideLayers('Layer1','','hide','Layer3','','show')" value="Upload your photo"> </p> <input type="hidden" name="MM_insert" value="form1"> </form> check if its a jpeg and resize image to 140pixels. if(isset($_POST['sent'])){ unset($submit); if (isset($_POST['sent'])) $submit = true; else die('Error: No file got sent'); if($_FILES['file']['name']) { $arr = getimagesize($_FILES['file']['tmp_name']); list($width, $height, $type, $attr) = getimagesize($_FILES['file']['tmp_name']); if($type == FALSE) { header("Location: uploadform2.php"); exit(); } elseif($type != 2) { header("Location: uploadform2.php"); exit(); } } $fieldname = $_FILES['file']; function resizeimage($name){ $filename = './uploads/'.$name; if(file_exists($filename)) { ini_set('memory_limit', '500M'); set_time_limit ( 0 ); $image = imagecreatefromjpeg($filename); //unresized image $im_info = getimagesize($filename); //unresized image $im_width = $im_info[0]; $im_height = $im_info[1]; $im_flag = $im_info[2]; //max height: 100px; max width: 100px if($im_width >= $im_height) { $im_divice = $im_width / 140; }else { $im_divice = $im_height / 140; } $thumb_width = $im_width / $im_divice; $thumb_height = $im_height / $im_divice; //create empty image $thumb = imagecreatetruecolor($thumb_width, $thumb_height); //resize image imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $im_width, $im_height); if(imagejpeg($thumb, "thumbnails/".$name, 80)) { //image-resource, filename, quality return 1; } imagedestroy($thumb); //destroy temporary image-resource imagedestroy($image); //destroy temporary image-resource } } After this it resizes the image to 300pixels and saves it to another folder. My phi.ini - upload_max_filesize: 20M max_execution_time: 300 memory_limit: 300M post_max_size: 55M SMTP: localhost extension=php_gd2.dll On the server it has GD 1.6.2 (FreeType, TTF library, GIF Read/Create, JPG, PNG, WBMP) is this ok?
  4. I tried both things and i still get server error 500. This is so frustrating!
  5. i opened the image in word (i dont have wordpad), i saw no error. I tried uploading a 442k jpeg, 3500pixels wide. It saved to the server but when it came to resizing the image i got server error 500. This is my php.ini file now- upload_max_filesize: 20M max_execution_time: 300 memory_limit: 300M post_max_size: 16M SMTP: localhost extension=php_gd2.dll
  6. Huggie, yes, my mistake. i've increased the Memory_limit to 140M. When I try uploading an image i see the browser working for 40-50 seconds and then it brings up the page which says the image isn't a jpeg but i know it is. When i try another jpeg it saves it to the server but i get the server error when it tries to resize it. I'm totally confused!
  7. yes i can view/modiy php.ini. memory_limit is 40M. shall i increase it?
  8. It resizes big images fine when i try on my local server but on the remote server i get internal server error 500
  9. Here are all the echoed values- im_width3072 Notice: Use of undefined constant im_height - assumed 'im_height' in C:\Program Files\xampp\htdocs\epeople\uploadform.php on line 104 im_height2304 Notice: Use of undefined constant im_flag - assumed 'im_flag' in C:\Program Files\xampp\htdocs\epeople\uploadform.php on line 105 im_flag2 Notice: Use of undefined constant im_divice - assumed 'im_divice' in C:\Program Files\xampp\htdocs\epeople\uploadform.php on line 109 im_divice21.9428571429 Notice: Use of undefined constant thumb_width - assumed 'thumb_width' in C:\Program Files\xampp\htdocs\epeople\uploadform.php on line 116 thumb_width140 Notice: Use of undefined constant thumb_height - assumed 'thumb_height' in C:\Program Files\xampp\htdocs\epeople\uploadform.php on line 117 thumb_height105 How do i check the site logs for any expanded error information?
  10. Thanks. I forgot to change comments to 140px The images come from what users upload. I've echoed the assigned values such as $thumb_width and $thumb_height, no value resolves to 0. This is really annoying as it works on smaller images. What can i do now?
  11. i ran phpinfo to check if i've got gd library enabled and it says- Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" Does that mean it is enabled?
  12. Thanks, Huggie. Yes, it must be the resize script as i tried echoing something to the screen before the resizing and it came up. No, I'm not using the GD library for resizing.. Here's my resizing script- function resizeimage($name){ $filename = './uploads/'.$name; if(file_exists($filename)) { $image = imagecreatefromjpeg($filename); //unresized image $im_info = getimagesize($filename); //unresized image $im_width = $im_info[0]; $im_height = $im_info[1]; $im_flag = $im_info[2]; //max height: 100px; max width: 100px if($im_width >= $im_height) { $im_divice = $im_width / 140; }else { $im_divice = $im_height / 140; } $thumb_width = $im_width / $im_divice; $thumb_height = $im_height / $im_divice; //create empty image $thumb = imagecreatetruecolor($thumb_width, $thumb_height); //resize image imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $im_width, $im_height); if(imagejpeg($thumb, "thumbnails/".$name, 80)) { //image-resource, filename, quality return 1; } imagedestroy($thumb); //destroy temporary image-resource imagedestroy($image); //destroy temporary image-resource } } It does work sometimes. What's wrong with it?
  13. I've changed the php.ini to upload_max_filesize: 20M max_execution_time: 300 memory_limit: 80M post_max_size: 16M SMTP: localhost tried uploading a 1.24mb image, 2550pixels wide and got- Error 500 - Internal server error An internal server error has occured! Please try again later. Surely, the settings in the php.ini must b high enough??
  14. the error is server error 500. How high should i go with the memory_limit and the max_execution_time? Thanks
  15. I've a script that lets users upload jpeg images and then the script resizes them. I've tried uploading an image sized 1.95MB and 2150 pixels wide, it uploads fine. However, when i tried uploading an image sized 1.24MB and 2575 pixels wide i got server error whch i find weird. Anyone know why? My php.ini- upload_max_filesize: 20M max_execution_time: 300 memory_limit: 40M post_max_size: 16M SMTP: localhost
  16. Thanks. Tried uploading an image sized 1.95MB and 2150 pixels wide but when i tried uploading an image sized 1.24MB and 2575 pixels wide i got server error. Anyone know why this happens?
  17. in the php.ini file i've got- upload_max_filesize: 20M is that the same thing?
  18. Thanks. I've put- <input type="hidden" name="MAX_FILE_SIZE" value="2000000000"> Tried uploading an image sized 1.95MB and 2150 pixels wide but when i tried uploading an image sized 1.24MB and 2575 pixels wide i got server error. That doesn't makes sense does it?
  19. Thanks I increased the max_execution_time to 60 and now i get- Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 10000 bytes) in /homepages/3/d209077294/htdocs/uploadform.php on line 95
  20. When I try to upload an image that is bigger than 2000 pixels wide i get server error 500. It does save the image on to the server. The error comes when it tries to resize the image. Here's the resize script- function resizeimage($name){ $filename = './uploads/'.$name; if(file_exists($filename)) { $image = imagecreatefromjpeg($filename); //unresized image $im_info = getimagesize($filename); //unresized image $im_width = $im_info[0]; $im_height = $im_info[1]; $im_flag = $im_info[2]; if($im_width >= $im_height) { $im_divice = $im_width / 140; }else { $im_divice = $im_height / 140; } $thumb_width = $im_width / $im_divice; $thumb_height = $im_height / $im_divice; //create empty image $thumb = imagecreatetruecolor($thumb_width, $thumb_height); //resize image imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $im_width, $im_height); if(imagejpeg($thumb, "thumbnails/".$name, 80)) { //image-resource, filename, quality return 1; } imagedestroy($thumb); //destroy temporary image-resource imagedestroy($image); //destroy temporary image-resource } } Any ideas?
  21. I'm still having trouble. Can I have some more help please?
  22. The server on which my website is host has a default max_filesize of 20mb so i can't understand why it won't accept files bigger than 1mb.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.