Welcome Guest, Not a member yet? Register   Sign In
image_lib bug?
#2

[eluser]fesweb[/eluser]
If it's not a bug, it is short-sighted at least. I found the same issue yesterday and wanted to suggest a fix to the development team.

Now I just extended the library; using the constructor to capture the default values to an array, and reset function overwrites the vars with the defaults from that array. It seems to work so far.

Here is what I've got
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* Add reset function to restore var defaults
*
* @author fesweb -
* @package EYE
* @subpackage Libraries
* @category Libraries
*/
class MY_Image_lib extends CI_Image_lib {

    var $var_defaults = array();
    
    function __construct()
    {
        parent::__construct(); // Extends the image_lib library    
        foreach ($this as $var => $value)
        {
            $this->var_defaults[$var] = $value;
        }
        // echo var_dump($this->var_defaults);
    }
    function reset()
    {
        foreach ($this->var_defaults as $var => $value)
        {
            $this->$var = $value;
        }
        // echo var_dump($this->var_defaults);
    }
}


Messages In This Thread
image_lib bug? - by El Forum - 02-24-2011, 04:16 AM
image_lib bug? - by El Forum - 03-10-2011, 11:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB