Help on adding the Imagine Library in Codeignighter |
Hello everyone, long time user of CI but new to this forum.
I have been trying to integrate or add the Imagine Library into CI but have been very unsuccessful. Don't really get the "namespaces" and "use" concept I guess I just got use to CI that anything else just doesn't seem right. Anyway if anyone can help I will really appreciated, and if anyone asks why not use CI image library well, I need more function specially when dealing with layers in animated gifs and pdfs and more control when it comes to rotating and other image manipulations that the basic CI image library can't do. By the way I am using CI latest stable version 2.* can't wait for the stable 3.* Again thank you in advance for anyone that can help.
Just wanted to share with everyone how to implement the Imagine image library on their CI application.
Follow these steps. 1 download the Imagine Library at: https://github.com/avalanche123/Imagine 2 Copy the Imagine folder into your CI application libraries folder: application/libraries 3 Create a file and call it imagine_autoload.php 4 add the following code to the imagine_autoload.php file PHP Code: <?php Now lets create the controller to do some image manipulation. PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Now check the path of where the image was saved and you should find a thumbnail. So get creative and read the documentation at: http://imagine.readthedocs.org/en/latest/
An advice ..
Make a Model Imagine and there init the library and make methods for the thing which you will need with just passing 1-2 variables. Don't use this directly at Controller. An one note - when you move to CI3 it has an option to use composer and with composer you wont need this solution as it has autoloader. Best VPS Hosting : Digital Ocean
(01-27-2015, 04:36 AM)sv3tli0 Wrote: An advice .. As you can see the controller is for testing purposes. But in reality you can use the library anywhere you want. I was just showing how you implement the library in CI since I couldn't find any info on implementing the library. As always is up to the developer on how to use the information. As far as composer, I am not really sure it would help since all it does is or what I think it does is download the files of a specific library to your application from there is up to you on how to apply it on your own application. But if it will go right up ahead and do the work for me then I can't wait for CI 3 to become stable to give it a try. |
Welcome Guest, Not a member yet? Register Sign In |