milesj / uploader

[Deprecated] A CakePHP plugin for file uploading and validating.
MIT License
193 stars 73 forks source link

blank page when applying transforms #142

Closed dotfish closed 11 years ago

dotfish commented 11 years ago

I've tried a number of variations of this but to no avail.

Each time I apply any transforms, it seems to fail. I've managed to upload a file without any transforms and the record is stored in the database correctly. Once I use any kind of transform, when I submit the page it will return a blank page. In the background it will upload the original file but the resized file does not get uploaded and the record is not saved in the database.

For my development environment I'm using: Macbook Pro (Mountain Lion) cakephp 2.3.7 MAMP with php 5.3.20

Using composer I loaded Uploader 4.3.1 and in Plugins I see only Transit 1.4.3.

The code in my model looks like this:

public $actsAs = array( 'Uploader.Attachment' => array( 'image' => array( 'uploadDir' => 'img/uploads/', 'maxNameLength' => 30, 'overwrite' => true, 'stopSave' => true, 'allowEmpty' => false, 'transforms' => array( 'scale' =>array( 'method' => 'resize', 'width' => 750, //'height' => 75, 'aspect' => true, 'mode' => 'width', 'self' => true, 'dbColumn' => 'image' ), 'thumb' =>array( 'method' => 'crop', 'width' => 100, 'height' => 75, 'aspect' => true, 'mode' => 'width', 'self' => true, 'dbColumn' => 'thumb' ) ) )
) );

milesj commented 11 years ago

Do you have the GD extension enabled? That's probably why transforms fail and uploads work.

Anything in the logs?

dotfish commented 11 years ago

Looking at my phpinfo page, it seems it is enabled.

image

Also, neither the apache or php_error log seem to have anything in them. I cleared them, restarted MAMP and then tested again. Logs attached.

image

image

milesj commented 11 years ago

What about cakes logs?

dotfish commented 11 years ago

Apologies, should have sent that straight away too.

I again backed up the old log that contained some irrelevant logging and then started the application up again. I removed a coma in my model to regenerate the log and then re-ran the upload test.

This is the error.log: image

dotfish commented 11 years ago

If it helps, here is a screenshot of console with the installation of the plugin.

test_uploader__bash__bash__8063

Thanks for your help thus far! I've been banging my head on this for a while. I still fear it may be something simple.

robksawyer commented 11 years ago

If you post your form code and the action that the form is calling to http://gist.github.com, I can take a look to see if it's anything simple.

dotfish commented 11 years ago

Thanks for taking a look Rob.

I've set up a very simple app to try troubleshoot this issue and that's what all the above reports / logs are based on.

Gist can be found at https://gist.github.com/dotfish/6522430

milesj commented 11 years ago

Have you tried turning of memory/time limits? I wonder if it's taking too long and exiting.

dotfish commented 11 years ago

I'm happy to try that, though I"m unsure how.

Looking at the Network Panel on Chrome's Developer tools, I can see that the post requests returns a status 200 code in about 1.75 seconds.

milesj commented 11 years ago

Add this to the upload page:

ini_set('memory_limit', '-1');
set_time_limit(0);
dotfish commented 11 years ago

Miles, that seems to work!

Could i be simply due to the size of the images I'm using for testing? I'm using 3600x2400 (3 - 5MB) images.

milesj commented 11 years ago

Most definitely. PHP can't really handle images well over 2MB, anything larger than that needs special attention.

dotfish commented 11 years ago

Miles, thank you so much for your help in this regard. Apologies for opening a 'false' bug report. Perhaps this may help out someone else who runs into this issue.

I'm developing a site for a professional photographer to upload photo albums so next step is to work on adding multiple images to a gallery in a single step. I'm sure with your excellent plugin that this should be relatively easy to do.

I'm assuming that I'll have to tweak the memory limit and time limit somewhat?

milesj commented 11 years ago

You can place the memory/time limit at the top of the controller that does the uploading, that should solve the problem. If not, in core or bootstrap.

This should help with multiple uploads: http://milesj.me/code/cakephp/uploader#faq-5