Blank Page after upload.

See all posts Reply

Blank Page after upload. new!
by Vinicius Sato, 12 years, 2 months ago
I'm using the last version and I always get a blank page after:
$handle = new Upload($_FILES['image_field']);"

Anything I echo before it will be printed with no problem whatsoever, but it just tilt after this line. Not even try/catch stop it from happening.
I even checked for memory limit, it's 100M and my folder permissions are 777.

Here is the code:
try {
  $handle = new Upload($_FILES['image_field']);
} catch(Exception $e) {
  echo $handle->log;
}
/*$handle->file_dst_path =  "downloads/";
echo "blabla";
if ($handle->uploaded) {
  $handle->file_new_name_body   = 'image_resized';
  $handle->process('downloads/');
  if ($handle->processed) {
    echo 'image resized';
    $handle->clean();
  } else {
    echo 'error : ' . $handle->error;
  }
}
*/
$idsalvo = salvarTipoAuditoria(($_POST["id"]?$_POST["id"]:NULL),utf8_decode($_POST["tipo"]),utf8_decode($_POST["descricao"]),$imagem,time(),($_POST["status"]?$_POST["status"]:1));
Reply
Re: Blank Page after upload. new!
by Vinicius Sato, 12 years, 2 months ago
I know I commented some part of it, it's because I was trying to isolate the problem.Reply
Re: Blank Page after upload. new!
by colin, 12 years, 2 months ago
What does the webserver say? Apache logs for instance...Reply
Re: Blank Page after upload. new!
by Dan Patterson, 12 years, 2 months ago
Hi,
I get same problem only in IE8. Code appears to stop at ->process. Works fine on FF and IE9

I can't find any reference to this issue for IE8.

Server error log shows nothing.

DanReply
Re: Blank Page after upload. new!
by Dan Patterson, 12 years, 2 months ago
Hi,

Just done some more checking. If I run Process without any file or image changes, i.e. a straight file upload it works fine in IE8, but as soon as I add anything bofore the process say something like :
$handle1->mime_check           = false;
$handle1->mime_magic_check     = false;
$handle1->file_auto_rename     = false;
$handle1->image_resize         = true;
$handle1->image_ratio          = true;
$handle1->image_x              = 1600;
$handle1->image_y              = 1600;

It does not process and no error is given, just stops.

Wonder if this provides clues?

DanReply
Re: Blank Page after upload. new!
by colin, 12 years, 2 months ago
It cannot have anything to do with the browser you are using.

In fact, you are running out of memory. Search for memory in the site, or click here.

You can also check this post.Reply
Re: Blank Page after upload. new!
by Dan Patterson, 12 years, 2 months ago
Thanks for the suggestion. But, I have tried this but it doesn't work. I used the following, which I use on the same server account for other file processing:

set_time_limit(6000);
ini_set("max_input_time", "6000");
ini_set("max_execution_time", "6000");
ini_set("memory_limit", "650M");
ini_set("upload_max_filesize", "20M");
ini_set("post_max_size", "20M");

Also, tried uploading a php.ini file to the root. My host does allow this as I have used this before.

I have no problems with FF, IE9 and Safari 5

Thanks, DanReply
Re: Blank Page after upload. new!
by colin, 12 years, 2 months ago
You need to check if the ini_set calls are actually modifying the PHP config. On most shared hosts, you cannot change some settings.

You say it works on FF, IE9 but not IE8? With the exact same image? The browser shouldn't matter at all.Reply
Re: Blank Page after upload. new!
by Dan Patterson, 12 years, 2 months ago
Hi,

I even have access to the php.ini via cpanel and it is currently set as 256M memory limit, so even if my ini_set calls are not working it should be fine.

However, I tried the exact same image on FF and it doesn't work. so it's the image that's the problem. it's a .jpg, file size is about the same as the one that works, but the pixel size is very different.

The processing I am using is:
$handle1->no_script=false;
$handle1->mime_check=false;
$handle1->mime_magic_check=false;
$handle1->file_auto_rename=false;
$handle1->file_overwrite= true;
if ($handle1->image_src_x > 1600 || $handle1->image_src_y > 1600) {
  $handle1->image_resize=true;
  $handle1->image_ratio=true;
  $handle1->image_x=1600;
  $handle1->image_y=1600;	
  $handle1->jpeg_quality=95;
}

So wonder if this is causing the problem?

Thanks for your help here.

Cheers, DanReply
Re: Blank Page after upload. new!
by colin, 12 years, 2 months ago
As I said, you are very likely running out of memory.

Your destination image is 1600x1600. This requires at least 1600*1600*8 which is about 20MB. Assuming your source image is 2000x2000, you will have to add at least 30MB. It is already 50MB just for the images to be in memory. To this, you add the memory required by your project, etc...

An easy test to see whether it is memory or not: change your destination sizes to 160x160, and try to upload an approx 200x200 pixels image. If this one uploads and resizes properly, but the larger images don't, then it is a memory issue.Reply
Re: Blank Page after upload. new!
by Dan Patterson, 12 years, 2 months ago
Thanks for the explanation. I have set memory limit to 650M then to 1G , but still not enough. Will try more!

My source image is 4608 X 3072 and am processing it 4 times to 4 different sizes.

Even if I don't process the first time the remaining 3 don't work either.

Not really sure how to deal with this since images that will be uploaded by users are likely to be of large pixel size, i.e. from a digital camera.

Thanks, DanReply
Re: Blank Page after upload. new!
by colin, 12 years, 2 months ago
Check you webserver logs, it will tell you why the page crashes.

If you need to upload very large images, you'd better off using ImageMagick for instance; PHP/GD is not really appropriate for intensive processing.Reply