Code Monkey home page Code Monkey logo

Comments (9)

quasiperfect avatar quasiperfect commented on September 3, 2024

update

i created a library omnipay using multiplayer as example and now i get Fatal error: Cannot access property Omnipay::$factory

I solved this by extending \Omnipay\Common\GatewayFactory

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on September 3, 2024

I will test installing the mentioned components and will report here.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on September 3, 2024

@quasiperfect

About https://code.google.com/p/php5-image/

A way that I found:

Uncompress the zip, grab the folder Image/ (that is under src/) and put it inside platform/common/classes/

So, you have the folder platform/common/classes/Image/

Search the source within this folder and comment everywhere all the require_once statements.

Then within Welcome_controller, at the beginning of index() method put this testing code:

$image = new Image_Image(DEFAULTFCPATH . 'assets/img/playground.jpg');

$image->attach(new Image_Fx_Resize(200));
$image->attach(new Image_Fx_Crop(0, 86));
$image->attach(new Image_Draw_Border(2, "000000"));
$image->attach(new Image_Fx_Canvassize(0, 10, 10, 0));
$watermark = new Image_Draw_Watermark(new Image_Image(DEFAULTFCPATH . 'assets/img/lib/smileys/smile.gif'));
$watermark->setPosition("br");
$image->attach($watermark);
$image->imagePng();
exit;

As a result, instead of the home page you will see a manipulated image.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on September 3, 2024

The second way:

Grab the folder Image/ and put it within platform/common/classes/Image/third_party/pear/

You would have platform/common/classes/Image/third_party/pear/Image/

In this case you would not need to modify the sources. This library likely follows the PEAR convention.

Then run the testing code again.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on September 3, 2024

@quasiperfect

About the Composer package I see that you have success.

This is an old forum discussion with me https://ellislab.com/forums/viewthread/246558/ It is about pure CodeIgniter, but I think, you can figure out where the mentioned files and directories are placed in this platform.

And another similar article: http://avenir.ro/codeigniter-tutorials/codeigniter-with-composer/
But there the mentioned line
require_once APPPATH.'vendor/autoload.php';
within config.php is not needed in this platform.

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on September 3, 2024

@quasiperfect

https://github.com/npetrovski/php5-image I am not sure whether the author is the same. I can see that refactoring for PHP 5.4 is going on there.

from starter-public-edition-4.

quasiperfect avatar quasiperfect commented on September 3, 2024

hi
thanks a lot for the info

the composer part was ok to digest and i managed to understand it

about the php5-image can you explain how are the classes loaded in the first method (comment require) and second one (pear) ?

from starter-public-edition-4.

ivantcholakov avatar ivantcholakov commented on September 3, 2024

This is the autoloader that I maintain in this platform: https://github.com/ivantcholakov/starter-public-edition-4/blob/master/platform/bootstrap/autoload.php

It is called as early as it is possible, even before the normal configuration files are read. It is for non-Composer stuff.

(By the way, if you activate Composer too, its autoloader registers at the first place and is called at first place.)


php5-image, the first way, under classes/ subdirectory:

The autoloader looks at classes/ directory and seeks based on the class name a file, or subdirectory (or subdirectories) and file. Underscores in the class name are treated as directory separators.

The require_once lines are wrong, because the paths are relative and the base directory of the application is different. And, they are not needed, because the autoloader does the job.

classes/ is my place where I can just drop a class (without namespaces, and that is not a CodeIgniter library) and it can be used immediately everywhere.

Something similar I've proposed for those that start from clean CodeIgniter http://forum.codeigniter.com/thread-420-post-1937.html#pid1937


php5-image, the second way, under the third_party/pear/ subdirectory:

The autoloader works in the same way. But the PEAR packages do not require/need an autoloader, this is why these require_once lines inside the class files are put by the author. Again, the base directory of the application is wrong and require_once lines don't find their targets immediately.

See however this line: https://github.com/ivantcholakov/starter-public-edition-4/blob/master/platform/bootstrap/bootstrap.php#L269 The third_party/pear/ directory is at the first place in the additional include paths to be searched. Then the require_once statements work, they are not to be removed. This is how an old PEAR package can be integrated within your application only.

In the second way, the autoloader will find the Image_Image class, but the other classes within the package will be loaded by the require_once statements, as the author determined.


For this particular package php5-image - I would prefer to place it under pear/ , simply because I would not need to touch the sources.

from starter-public-edition-4.

quasiperfect avatar quasiperfect commented on September 3, 2024

that was very nice and clear info
maybe you should add that to the main page i'm sure will help somebody

thanks again for all your work

from starter-public-edition-4.

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.