Coder Social home page Coder Social logo

Comments (4)

oscarotero avatar oscarotero commented on June 10, 2024

Hi, Hengki.
No problem. I guess this library should work as any other library but I didn't try. What do you need?

from imagecow.

hengkiardo avatar hengkiardo commented on June 10, 2024

can you create the sample implement on CI?

from imagecow.

swas avatar swas commented on June 10, 2024

Hello!

You can create a custom CI library (http://codeigniter.com/user_guide/general/creating_libraries.html) to use imageCow.

Here's an example: https://gist.github.com/3933552

Put imagecow.php, imagecow_loader.php and the source of imageCow in the directory application/libraries/ of CI

The content of imagecow_loader.php was extracted from here: https://github.com/oscarotero/imageCow/blob/master/test/loader.php

Initialize and call the library in your controller:

$this->load->library('imagecow');
$Image = $this->imagecow->get_lib();

Then you can use $Image following the imageCow API

from imagecow.

oscarotero avatar oscarotero commented on June 10, 2024

Thank you, @swas !!

imagecow_loader contains a class to load the imageCow library that uses the PSR-0 standard. If you prefer, you can use this lighter function that makes the same but with less features:

function autoload ($className) {
    $className = ltrim($className, '\\');
    $fileName  = '';
    $namespace = '';

    if ($lastNsPos = strripos($className, '\\')) {
        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }

    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

    if (is_file($fileName)) {
        require $fileName;
    }
}

spl_autoload_register('autoload');

from imagecow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.