Using Kohana inside Yii
Sometimes to write a custom autoloader, you need to dig into another framework's source code. An example of this is the Kohana framework. In this recipe, we will handle image resizing by using one of the Kohana classes.
Getting ready
Create a fresh application using
yiic webapp.Download the Kohana framework 3.1.5 archive from the following URL:
http://dev.kohanaframework.org/projects/kohana3/files
In this recipe, we have used Version 3.1.5.
Extract the
systemandmodulesdirectories toprotected/vendors/Kohana.
How to do it...
Carry out the following steps:
First, we will need the actual code that performs the image resizing and displays an image. Create
protected/controllers/ImageController.phpas follows:<?php class ImageController extends CController { public function actionIndex() { $image = new Image_GD(Yii::getPathOfAlias("system")."/yii-powered.png"); $image->resize(800, 150); Yii::app()->request->sendFile("image.png", $image->render...