CodeIgniter Forums
How to use library in a helper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to use library in a helper (/showthread.php?tid=26765)



How to use library in a helper - El Forum - 01-22-2010

[eluser]Matthieu Brunet[/eluser]
Hi there,
I want to create a custom helper to manage thumbnail. So in this helper, I will need to use the image library.
What is the best way to load a library in a helper, as I suppose I can't do
$this->load->library("image");

thanks.


How to use library in a helper - El Forum - 01-22-2010

[eluser]danmontgomery[/eluser]
[quote author="Matthieu Brunet" date="1264200459"]Hi there,
I want to create a custom helper to manage thumbnail. So in this helper, I will need to use the image library.
What is the best way to load a library in a helper, as I suppose I can't do
$this->load->library("image");

thanks.[/quote]

Code:
$CI =& get_instance();
$CI->load->library("image_lib");

...

$CI->image_lib->resize();



How to use library in a helper - El Forum - 01-22-2010

[eluser]Matthieu Brunet[/eluser]
Groovy baby !!

thanks a lot :+)