ERROR: Kohana_Exception [ 0 ]: Not an image or invalid image: ~ APPPATH/kohana/modules/image/classes/Kohana/Image.php [ 109 ]

322 views Asked by At

Im not sure where to post this issue. I hope you guys can help me. It's been a long time but i cant find any answer in how to fix this error.

ERROR: Kohana_Exception [ 0 ]: Not an image or invalid image: ~ APPPATH/kohana/modules/image/classes/Kohana/Image.php [ 109 ]

my website is (linkinads.com).. I try to search for possible reason but seems all the images are in correct format. Try to visit maybe you find something. Or suggestion in how to solve this. Thank you

2

There are 2 answers

0
bato3 On

Without full trace isn't possible to tell more than - check adding images process.

0
Max Sherbakov On

try to remove spaces of the image name, like this

# remove espaços do nome da imagem, se não o módulo Image não funciona corretamente
# remove spaces of the image name, otherwise the Image module doesn't work correctly
$_FILES['imagem']['name'] = preg_replace('/\s+/', '', $_FILES['imagem']['name']) ;
# troca espaços por underline
Upload::$remove_spaces = TRUE;
# Upload o arquivo
Upload::save($_FILES['imagem'], $_FILES['imagem']['name'], $this->_path );

or try catch err with try -> catch and before upload file verify file size and type.

        $finfo = new finfo();
        $fileMimeType = $finfo->file($image['file']['tmp_name'], FILEINFO_MIME_TYPE);
        if ($fileMimeType != 'image/jpeg'){
            @unlink($image['file']['tmp_name']);
            return FALSE;
        } else {
            return TRUE;
        }