[eluser]Sinclair[/eluser]
Hi,
I'm trying to extend the Upload Library to pop up an Error when images have less than X pixels.
Code:
<?PHP
class MY_Upload extends CI_Upload {
var $min_width = 0;
var $min_height = 0;
/**
* Set Minimum Image Height
*
* @access public
* @param integer
* @return void
*/
function set_min_height($n)
{
$this->min_height = ((int) $n < 0) ? 0: (int) $n;
}
/**
* Set Minimum Image Width
*
* @access public
* @param integer
* @return void
*/
function set_min_width($n)
{
$this->min_width = ((int) $n < 0) ? 0: (int) $n;
}
/**
* Verify that the image is within the allowed minimum width/height
*
* @access public
* @return bool
*/
function is_allowed_min_dimensions()
{
if ( ! $this->is_image())
{
return TRUE;
}
if (function_exists('getimagesize'))
{
$D = @getimagesize($this->file_temp);
if ($this->min_width > 0 AND $D['0'] > $this->min_width)
{
return FALSE;
}
if ($this->min_height > 0 AND $D['1'] > $this->min_height)
{
return FALSE;
}
return TRUE;
}
return TRUE;
}
}
I have this until now. What I need to do more to get this extend working. And wich is the best way of doing this extend without broke the CI compatibility?
Best Regards,