Welcome Guest, Not a member yet? Register   Sign In
How to generate on the fly images with image_lib?
#4

[eluser]Sinclair[/eluser]
Hi,

First of all, thanks for the replys.

I have found something that works, but I need to resize and watermark on the fly, whitout changing the original image file.

I have to functions that I'am testing:


Code:
function get_photo($folder, $file){
        
        $path = 'c:/xampp/htdocs/acomp_www/' . $folder . '/' . $file;
        #$path = 'c:/xampp/htdocs/acomp_www/1/2.jpg';
        #$this->load->library('image_lib');                    
           #$this->image_lib->clear();
        $imageinit['image_library']     = 'GD2';
        $imageinit['quality']            = '100%';
        $imageinit['dynamic_output']    = TRUE;
        #$imageinit['create_thumb']    = FALSE;
        $imageinit['source_image']         = $path;
        #$imageinit['maintain_ratio']     = false;
        $imageinit['width']             = '200';
        $imageinit['height']             = '150';
    
        $imageinit['wm_type'] = 'overlay';
        $imageinit['wm_overlay_path'] = 'c:/xampp/htdocs/acomp_www/1/w.png';
        $imageinit['wm_padding'] = '0';
        $imageinit['wm_hor_alignment'] = 'bottom';
        $imageinit['wm_vrt_alignment'] = 'center';
        
        $this->image_lib->initialize($imageinit);
        $this->image_lib->watermark();
        #$this->image_lib->clear();
        $this->image_lib->resize();
        if(!$this->image_lib->resize() && !$this->image_lib->watermark()){
        echo $this->image_lib->display_errors();
        }
    }

This function, Watermarks On The Fly, but not resize.




Code:
function get_photo($folder, $file){
        
        $path = 'c:/xampp/htdocs/acomp_www/' . $folder . '/' . $file;
        $this->load->library('image_lib');
        
        $config['thumbnail'] = array('source_image' => $path,
                                     'width' => '200',
                                     'height' => '150',
                                     'dynamic_output' => true);
        $this->image_lib->initialize($config['thumbnail']);
        $this->image_lib->resize();
        
        $this->image_lib->clear();
        
        $config['watermark'] = array('wm_type' => 'overlay',
                                     'source_image' => $path,
                                     'wm_overlay_path' => 'c:/xampp/htdocs/acomp_www/1/w.png',
                                     'wm_padding' => '20',
                                     'dynamic_output' => true,
                                     'create_thumb' => 'false',
                                     'wm_hor_alignment' => 'bottom',
                                     'wm_vrt_alignment' => 'center');
        $this->image_lib->initialize($config['watermark']);
        $this->image_lib->watermark();    
        
    #    if(!$this->image_lib->resize() && !$this->image_lib->watermark()){
        #echo $this->image_lib->display_errors();
        #}
    }

This function resize and watermarks, but when watermarking, change the image, add the watermark to the image withthe original image size.




My question. How can I get real Resize and Watermarking On The Fly without changing the original image files? Can you give me some clues?


Best Regards,


Messages In This Thread
How to generate on the fly images with image_lib? - by El Forum - 12-12-2009, 01:29 PM
How to generate on the fly images with image_lib? - by El Forum - 12-12-2009, 04:12 PM
How to generate on the fly images with image_lib? - by El Forum - 12-12-2009, 06:46 PM
How to generate on the fly images with image_lib? - by El Forum - 12-12-2009, 07:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB