Welcome Guest, Not a member yet? Register   Sign In
image library again
#1

[eluser]artificialkid[/eluser]
Hy guys
I´m trying to use the image library at the most basic example I can find in the user guide, I have GD installed,and I already checked the forum, but nothing helps and my GD version is 2.1210, my code is

Code:
<?php
class Shop extends Controller {
    
    

    function Shop()
    {
        parent::Controller();
        //$this->load->library('image_lib');    
    }
    
    function index()
    {
        $this->load->library('image_lib');
        $config['image_library'] = 'gd';
        $config['source_image'] ="./images/gallery/IMG_3668.jpg";
        $config['dest_image'] = './images/gallery/';
        //$config['create_thumb'] = 'TRUE';
        $config['width'] = '75';
        $config['height'] = '50';
    
        //$this->image_lib->initialize($config);
        //$this ->image_lib ->initialize($img_config);
    
            $this->image_lib->resize();
        if(!$this->image_lib->resize()){
            echo $this->image_lib->display_errors();
            
        }else{
            //echo('sucess');
        }
        
        //echo base_url();
        //$this->load->view('shop_view', $config);
    }
    

}
?>


my error
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Image_lib::$dest_image

Filename: libraries/Image_lib.php

Line Number: 476
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Image_lib::$dest_image

Filename: libraries/Image_lib.php

Line Number: 476

Your server does not support the GD function required to process this type of image.

Your server does not support the GD function required to process this type of image.

What i´m doing wrong?

if I try this code, no errors but no image in display

Code:
$config['image_library'] = 'gd';
        $config['source_image'] ="./images/gallery/IMG_3668.jpg";
        $config['dest_image'] = './images/gallery/';

        $config['width'] = '75';
        $config['height'] = '50';
    
        $this->load->library('image_lib');
        $this->image_lib->initialize($config);
        $this->image_lib->resize();
#2

[eluser]Michael Wales[/eluser]
Code:
$config['image_library'] = 'gd2';
#3

[eluser]artificialkid[/eluser]
Hy, i dont´have gd2, i´m using the osx package from www.entropy.ch/

i did var_dump(gd_info()); and i get

Code:
array(12) { ["GD Version"]=>  string(27) "bundled (2.0.28 compatible)" ["FreeType Support"]=>  bool(true) ["FreeType Linkage"]=>  string(13) "with freetype" ["T1Lib Support"]=>  bool(true) ["GIF Read Support"]=>  bool(true) ["GIF Create Support"]=>  bool(true) ["JPG Support"]=>  bool(true) ["PNG Support"]=>  bool(true) ["WBMP Support"]=>  bool(true) ["XPM Support"]=>  bool(false) ["XBM Support"]=>  bool(true) ["JIS-mapped Japanese Font Support"]=>  bool(false) }
#4

[eluser]Michael Wales[/eluser]
I don't know for sure, but I would assume GD2 = version 2, therefore version 2.0.28 is version 2, the 28th minor revision.

Try setting it to GD2 (just for grins) and let's see what happens. It may be case-sensitive (once again, not looking at the code).
#5

[eluser]jplanet[/eluser]
I am presently having this same problem, montyward, have you found a solution? My gdinfo dump shows: ["GD Version"]=> string(27) "bundled (2.0.34 compatible)".

I tried "GD2" as Michael advised, but it had no effect on the outcome...
#6

[eluser]artificialkid[/eluser]
No, i´m sorry, I will install map to see if i have the same error
#7

[eluser]jplanet[/eluser]
Ha, found it! I had to specify the output directory for thumbnails, and chmod that directory to 777...
#8

[eluser]omed habib[/eluser]
montyward,

Any luck? I'm on OSX too, but my staging server is running Linux. Both support GD2+ and both are giving me the exact same error. I don't think it has to do with the server not supporting the imaging library. For some reason the destination file is causing that error, and the problem has to do with the destination file...

Just a guess. Let me know what you got!
#9

[eluser]The Enlightened[/eluser]
Code:
function index()
    {
        $this->load->library('image_lib');
        $config['image_library'] = 'gd';
        $config['source_image'] ="./images/gallery/IMG_3668.jpg";
        $config['dest_image'] = './images/gallery/';
        //$config['create_thumb'] = 'TRUE';
        $config['width'] = '75';
        $config['height'] = '50';
    
        //$this->image_lib->initialize($config);
        //$this ->image_lib ->initialize($img_config);
    
            $this->image_lib->resize();

Make it like this :

Code:
function index()
    {
        $config['image_library'] = 'gd';
        $config['source_image'] ="./images/gallery/IMG_3668.jpg";
        $config['dest_image'] = './images/gallery/';
        //$config['create_thumb'] = 'TRUE';
        $config['width'] = '75';
        $config['height'] = '50';
    
        //$this->image_lib->initialize($config);
        //$this ->image_lib ->initialize($img_config);
        
        $this->load->library('image_lib',$config);
        
        $this->image_lib->resize();

That should solve the problem

Prasshhant




Theme © iAndrew 2016 - Forum software by © MyBB