Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorkkrzyzak
     

    Hi. I would like to manipulate with image (actually - resize it, and if it's possible - add watermark). I've found AkImage class, however, it's not well documented. Could someone paste here working snippet? Let's say, that I've got sth. like that: ` $content = file_get_contents($this->params['file']['tmp_name']); //upload orginal file Ak::file_put_contents(AK_PUBLIC_DIR.DS.'media'.DS.str_replace(' ','_',$this->params['file']['name']),$content); if($option==='createThumb'){

            //create thumb
            /*
            What I should do here? 
            */
    
            //upload thumb
             Ak::file_put_contents(AK_PUBLIC_DIR.DS.'media'.DS.'thumb'.DS.str_replace(' ','_',$this->params['file']['name']),$thumb_content);
        }
    

    `

    • CommentAuthorKaste
     

    see test/unit/lib/AkImage.php

        $Image = new AkImage($this->image_path);
        $Image->transform('resize',array('size'=>'50%'));
        $Image->save($this->image_path.'_thumb.png');
    
    • CommentAuthorKaste
     

    set desired width etc...

        $Image->transform('resize',array('size'=>'50x'));
        $Image->save($this->image_path.'_thumb.jpg');
    
    • CommentAuthorkkrzyzak
     

    Hi Kaste. Your code seems to don't work. $this->image_path = AK_PUBLIC_DIR.DS.'media'.DS.str_replace(' ','_',$this->params['file']['name']); Ak::file_put_contents($this->image_path,$content); //orginal file is well-uploaded include(AK_LIB_DIR.DS.'AkImage.php'); $Image = new AkImage(); $Image->load($this->image_path); $Image->transform('resize',array('size'=>'50x')); $Image->save($this->image_path.'_50x22.jpg'); I've got: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2304 bytes) in (...)/vendor/pear/Image/Transform/Driver/GD.php on line 148