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

[eluser]j4zzyh4ck3r[/eluser]
Code:
<?php
    /**
     * @property CI_Loader $load
     * @property CI_Image_lib $image_lib
     */
    class Image extends CI_Controller {
        function __construct() {
            parent::__construct();            
            $config['create_thumb'] = TRUE;
            $config['maintain_ratio'] = TRUE;
            $this->load->library('image_lib', $config);
        }
        
        function index() {
            NULL;
        }

        function resize() {
            $config['image_library'] = 'gd2';
            $config['source_image'] = './img/Desert.jpg';
            $config['width'] = 75;
            $config['height'] = 50;
            // $config['new_image'] = '/path/to/new_image.jpg';
            $this->image_lib->initialize($config);
            if ( ! $this->image_lib->resize()) $this->image_lib->display_errors();
            $this->image_lib->display_errors('<p>', '</p>');
        }
        
        function rotate() {            
            $config['image_library'] = 'netpbm';
            $config['library_path'] = '/usr/bin/';
            $config['source_image'] = './img/Desert.jpg';
            $config['rotation_angle'] = '90';            
            $this->image_lib->initialize($config);
            if ( ! $this->image_lib->rotate()) $this->image_lib->display_errors();
        }
    }
?&gt;

Is there anything wrong for rotate function (resize function works normally) ?
When I check my img folder, there were no change...




Theme © iAndrew 2016 - Forum software by © MyBB