Welcome Guest, Not a member yet? Register   Sign In
Image manipulation
#1

[eluser]PQMailer[/eluser]
I have a little problem. I have to functions in a model.
Code:
function m_thumb_create($text)
    {
        $config = array(
            'source_image' => $this->file_path . '/defaults/base_image.' . $this->image_ext,
            'new_image' => $this->file_path . '/images/' . $this->image_name . '.' . $this->image_ext,
            'maintain_ration' => true,
            'width' => (300+(strlen($text)*2.5)),
            'height' => 150,
            'thumb_marker' => '_safe'
        );
        
        $this->load->library('image_lib');
        $this->image_lib->initialize($config);
        if($this->image_lib->resize()){
            $this->image_lib->clear();
            return TRUE;
        }else{
            echo $this->image_lib->display_errors();
        }
    }
    
    function m_thumb_watermark($text)
    {
        $config = array(
            'source_image' => $this->file_path . '/images/' . $this->image_name . '.' . $this->image_ext,
            'wm_text' => $text,
            'wm_type' => 'text',
            'wm_font_path' => $this->file_path . '/defaults/base_font.ttf',
            'wm_font_size' => '16',
            'wm_font_color' => 'ffffff',
            'wm_vrt_alignment' => 'bottom',
            'wm_hor_alignment' => 'center',
            'wm_padding' => '20'
        );
        
        $this->load->library('image_lib');
        $this->image_lib->initialize($config);  
        if($this->image_lib->watermark()){
            $this->image_lib->clear();
            return TRUE;
        }else{
            echo $this->image_lib->display_errors();
        }
    }

I call this two functions in a third function, here:
Code:
function m_create($input)
    {
        if($this->m_thumb_create($input['text']) == TRUE)
            $this->m_thumb_watermark($input['text']);
    }
But the class don't watermark the created image, because the log says:
Quote:DEBUG - 2011-06-27 22:18:42 --> Image Lib Class Initialized
DEBUG - 2011-06-27 22:18:42 --> Image_lib class already loaded. Second attempt ignored.
How can i prevent that ci ignores the second initialize ?




Theme © iAndrew 2016 - Forum software by © MyBB