cakephpthumbnailsphpthumbmeio-upload

MeioUpload isn't creating thumbnails in cakephp 2.4


I'm using meioupload and everything works well till I try to make thumbnails. Then I can see only kind of phpThumb error message which says

"C:/wamp/cakephp/vendors/phpTmub/img/uploads/product/filename/image.png" does not exist

I'm new with cakePHP so I never faced this problem before. Does anyone know what should I do?

here is my model code:

var $actsAs = array(
    'MeioUpload' => array(
        'filename' => array(
            'create_directory' => true,
            'allowed_mime' => array('image/jpeg', 'image/pjpeg', 'image/png'),
            'allowed_ext' => array('.jpg', '.jpeg', '.png'),
            'zoomCrop' => true,
            'thumbsizes' => array(
                'normal' => array('width' => 400, 'height' => 300),
                'small' => array('width' => 80, 'height' => 80,'maxDimension' => '', 'thumbnailQuality' => 100, 'zoomCrop' => true),
                ),
            'default' => 'default.jpg'
            ) 
        ));

UPDATE:

I found special phpThumb for cakePHP 2.0 so the Path changed into this:

"C:/wamp/cakephp/img/uploads/product/filename/image.png"

and if I open default image in my browser th path is like:

localhost:8080/cakephp/img/uploads/product/filename/image.png

Thanks


Solution

  • I solved the problem, maybe not very elegant, but it works! For the first time, as I said, I downloaded special version of phpThumb for cakePHP.

    Here is link: https://github.com/simkimsia/phpThumb-for-cakephp-2.0

    After there was my problem with the path because my images was in folder: C:\wamp\www\cakephp\app\webroot\img\uploads\product\filename\image.png

    So I had to find this part of code(begins on line 1078):

    if ($this->useCake) {
                    if ($this->config_document_root != null) {
                        $AbsoluteFilename = $this->config_document_root.DIRECTORY_SEPARATOR.$filename;
                    } else {
                        $AbsoluteFilename = WWW_ROOT.DIRECTORY_SEPARATOR.$filename;
                    }
                }
    

    And edit a the path to fit into my folder:

    $AbsoluteFilename = $this->config_document_root.DIRECTORY_SEPARATOR.'cakephp'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'webroot'.DIRECTORY_SEPARATOR.$filename;
    
    $AbsoluteFilename = WWW_ROOT.DIRECTORY_SEPARATOR.'cakephp'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'webroot'.DIRECTORY_SEPARATOR.$filename;
    

    and now its working perfectly...