milesj / uploader

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

Problem with "transforms" method #183

Closed dangai-coder closed 10 years ago

dangai-coder commented 10 years ago

Hey, when i try to use the method transforms for generate a thumbnail that error occur :

"Invalid transformation method Error: An Internal Error Has Occurred."

and a stack trace with the problem.

I trying everthing but i not been so much successful.

Can you give me some hope? (:

That's is my code :

 public $actsAs = array(
    'Uploader.Attachment' => array(
        'foto' => array(
            'tempDir'   => TMP,
            'overwrite' => true,
            'uploadDir' => 'img/uploads/',
            'finalPath' => 'app/webroot/img/uploads/',
            'dbColumn'  =>  'file_name',
            'transforms' => array(
            'thumbs' => array(
                    'class' => 'resize',
                    'prepend' => 'thumbs-',
                    'overwrite' => true,
                    'self' => false,
                    'width' => 320,
                    'height' => 240,
                    'uploadDir' =>  'img/thumbs/',
                    'finalPath' =>  'app/webroot/img/thumbs/',
                    'dbColumn'  =>  'thumbs'
                )
            )
        )

    )
); 
milesj commented 10 years ago

The uploadDir needs to be absolute. The finalPath needs to be relative within the uploadDir path.

dangai-coder commented 10 years ago

Alright so forget this, let's try without de path, like in your tutorial :

'transforms' => array(
            'thumbs' => array(
                    'class' => 'resize',
                    'prepend' => 'thumbs-',
                    'overwrite' => true,
                    'self' => false,
                    'width' => 320,
                    'height' => 240
                )
            )

But the same error occurred with the same stack trace. That's strange or i doing something really wrong? Because i just followed your steps in tutorial.

P.S: i allready have a 'thumbs' column in my table.

milesj commented 10 years ago

Check your logs, the Uploader will write to it if something fails. I'm guessing it's a permissions problem, or the gd library is missing, or something along those lines.

milesj commented 10 years ago

Actually, what version of Cake and Uploader are you using?

dangai-coder commented 10 years ago

Cake 2.5.1 (The last version) and Uploader 4.0.0

milesj commented 10 years ago

The docs represent the latest Uploader version, 4.5.4, so I'd suggest upgrading to that version. If not, you'll have to view the source code and figure out the differences in configuration.

dangai-coder commented 10 years ago

Ok i will try fix it and will give you a feedback. Thank you so much for attention! :D :+1:

dangai-coder commented 10 years ago

Hey Miles, i updated my Uploader for the current version [4.5.4]. But now even in uploads that error occur :

Fatal Error
Error: Call to undefined function Transit\finfo_open()  
File: C:\wamp\www\CAKE_TESTE\app\Vendor\mjohnson\transit\src\Transit\File.php   
Line: 497

So, in File.php i find this :

            // Fallback because of fileinfo bug: https://bugs.php.net/bug.php?id=53035
            if (!$type) {
                $info = finfo_open(FILEINFO_MIME_TYPE);
                $type = finfo_file($info, $file->path());
                finfo_close($info);
            } 

After that a enable in php.ini the fileinfo extension, but the error persists. My php version is 5.3.5. I will kepp trying fix until all get ok. Thank you again for the attention, and sorry about the trouble.

milesj commented 10 years ago

Have you restarted PHP after enabling the fileinfo extension? Does it show up in the phpinfo() page?

dangai-coder commented 10 years ago

Dammit, i forgot about this. '-' Yeah, now is on the way! Thanks for your time.