![]() |
|
#1
|
|||
|
|||
|
I am having problems with imagecreatefromjpeg() hanging up while uploading files ~400 KB or larger. Am I doing anything wrong? Here is an example for jpg files:
upload form HTML Code:
<form action="upload.php" method="post" enctype="multipart/form-data"> Picture: <input name="userfile" type="file" id="userfile"> <br /> <input type="submit" name="uploadPic" value="Upload" /> </form> PHP Code:
![]() Do I have an error in my code I am over loooking? Thanks! Last edited by Scotty; 11-06-2009 at 02:43 PM. |
| Sponsored Links |
|
#2
|
|||
|
|||
|
Here is an update. I am pretty sure that the script works for all images. I tried it on a different server with the same images and everything worked as it should. I now believe that it is the fault of the server. This script is failing on 1and1.com servers (I am not a fan of this company).
I know that the GD Graphics Library is required for this script. To make sure the library is installed I tried phpinfo(); (in info.php) but that also fails on this server. For some reason it pulls my css style sheet, header graphic and required navigation php file. I have no clue why or how it gets all that when all I have is <?PHP phpinfo(); ?> in the info.php file. Can anyone tell me if 1and1.com has the GD graphics library installed and what version? Also, why does this script fail for large images (~400 KB or larger) on 1and1.com servers and not other servers? 1and1 is definitely frustrating! Better yet, can anyone tell me how to upload and resizes images a different way that 1and1 will like? Thanks for any help! |
|
#3
|
|||
|
|||
|
I tried a simple upload script without the resizing just to see if I could upload images larger than 400 KB. The script below works, however I don't know how to resize the image which is required for my application. Can anyone help me adapt this script below to resize the image?
PHP Code:
|
|
#4
|
|||
|
|||
|
use $_POST instead of $_REQUEST. also use proper html, add the quotes where they're supposed to be.
you said the script was working, just not on that host. if phpinfo isn't working, then the free accounts may not support it.
__________________
Unlimited Web Hosting If i actually managed to help you in any way, please +rep me! |
|
#5
|
|||
|
|||
|
Hi richei,
Yeah I fixed the poor HTML and use $_POST. It was just a script I grabbed to test with. Its not a free account which is why it is frustrating. But I was able to get the phpinfo and found that gd v2+ is installed. So I still don't know why it is hanging. It would be nice to know why it hangs, but using the example in my last post I have a crappy workaround. |
|
#6
|
|||
|
|||
|
I thought I would post a follow up for anyone who encounters this in the future.
I still haven't found any real solution and still don't know why this problem exists on the 1and1.com servers but I have discovered that this problem has nothing to do with the actual file size of the image. The problem occurs when the image is greater than 2043x1532 pixels from my testing. If I upload an image that size or smaller, everything works fine. If I try to upload an image just slightly bigger (1px to ~50px more), it creates a thumbnail but not the full sized image. I didn't include the thumbnail creation in my example code in my first post. But the thumbnail is created after the full size the same way as the full size. For the full sized image it does create a jpg file but it is 0kb. I don't understand how it creates the thumbnail and creates a 0kb image. But if a larger dimensioned image (~51px or more) is uploaded the script hangs on the imagecreatefromjpeg() call which was my original problem. These results where consistent with images ranging in file size of 49.2KB up to 2.47MB which ruled out file size and my guess of 400KB. Conveniently the camera I am using snaps pictures at 2272 x 1704 (229 x 172 too large). So my three solutions for 1and1.com servers (ranked in order of least desirable to most) are don't resize the image and just upload the original image using a similar script as the one in the last code I posted above. Or to resize my images manually and upload images that are 2043px by 1532px or smaller. Or chose any other host where this problem doesn't exist. Last edited by Scotty; 11-08-2009 at 01:06 AM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|