Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CImageHandler: added test cases

CLangUrlManager: added initial readme.md
  • Loading branch information...
commit f04f9c7b08bfad4b1824aa506f8074d0614ebccc 1 parent 5045266
@tokolist authored
View
BIN  images/image_handler/rabbit.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
48 protected/controllers/ImageHandlerController.php
@@ -52,5 +52,51 @@ public function actionWatermark()
->show();
}
-
+ public function actionPngWatermark()
+ {
+ Yii::app()->ih->load($this->basePath . 'paypal_512_trimmed.png')
+ ->watermark($this->basePath . 'paypal_512_trimmed.png', 10, 10, CImageHandler::CORNER_RIGHT_TOP, 0.2)
+ ->thumb(400,400)
+ ->show();
+ }
+
+ public function actionPngWatermark2()
+ {
+ Yii::app()->ih->load($this->basePath . 'paypal_512_trimmed.png')
+ ->watermark($this->basePath . 'wm370124tt.jpg', 10, 10, CImageHandler::CORNER_RIGHT_TOP, 0.2)
+ ->thumb(400,400)
+ ->show();
+ }
+
+ public function actionPngWatermark3()
+ {
+ Yii::app()->ih->load($this->basePath . 'paypal_512_trimmed.png')
+ ->watermark($this->basePath . 'rabbit.gif', 10, 10, CImageHandler::CORNER_RIGHT_TOP, 0.2)
+ ->thumb(400,400)
+ ->show();
+ }
+
+ public function actionPngWatermark4()
+ {
+ Yii::app()->ih->load($this->basePath . 'rabbit.gif')
+ ->watermark($this->basePath . 'paypal_512_trimmed.png', 10, 10, CImageHandler::CORNER_RIGHT_TOP, 0.2)
+ ->thumb(400,400)
+ ->show();
+ }
+
+ public function actionPngWatermark5()
+ {
+ Yii::app()->ih->load($this->basePath . 'wm370124tt.jpg')
+ ->watermark($this->basePath . 'rabbit.gif', 10, 10, CImageHandler::CORNER_RIGHT_TOP, 0.2)
+ ->thumb(400,400)
+ ->show(CImageHandler::IMG_PNG);
+ }
+
+ public function actionPngWatermark6()
+ {
+ Yii::app()->ih->load($this->basePath . 'rabbit.gif')
+ ->watermark($this->basePath . 'wm370124tt.jpg', 10, 10, CImageHandler::CORNER_RIGHT_TOP, 0.2)
+ ->thumb(400,400)
+ ->show(CImageHandler::IMG_PNG);
+ }
}
View
4 protected/extensions/yiicomp/components/LangUrlManager/CLangUrlManager.php
@@ -1,7 +1,7 @@
<?php
/**
- * This extension allows you to pass the application language via the url
- * and then use it for all further generated urls
+ * This extension allows you to pass the application language via the URL
+ * and then use it for all further generated URLs
* @author Ekstazi http://yii-blog.blogspot.com
* @author Yaroslav Pelesh aka Tokolist http://tokolist.com
* @link https://github.com/tokolist/yii-components
View
62 protected/extensions/yiicomp/components/LangUrlManager/readme.md
@@ -0,0 +1,62 @@
+CLangUrlManager
+=============
+
+`CLangUrlManager` - this extension allows you to pass the application language
+via the URL and then use it for all further generated URLs.
+
+Installation
+------------
+
+1. Copy LangUrlManager directory to Yii `components` directory
+
+2. Add import path
+
+~~~php
+'import'=>array(
+
+ ...
+
+ 'application.components.LangUrlManager.CLangUrlManager',
+
+ ...
+
+)
+~~~
+
+3. Add following code to `config/main.php` or merge with your current URL Manager
+settings
+
+~~~php
+'components'=>array(
+ ...
+
+ 'urlManager'=>array(
+ 'class'=>'application.components.LangUrlManager.CLangUrlManager', //specify component class
+ 'languages'=>array('en','ru'), //available languages
+ 'langParam'=>'lang', //GET parameter name used for language definition
+ 'langCookieName'=>'yii_lang', //cookie name used for storing language
+
+ 'urlFormat'=>'path',
+ 'showScriptName'=>false,
+
+ //add lang parameter to the rules if necessary
+ 'rules'=>array(
+ ...
+
+ ...
+ ),
+ ),
+
+ ...
+)
+~~~
+
+4. Add the following code to your protected/components/Controller.php init method
+
+~~~php
+public function init()
+{
+ parent::init();
+ Yii::app()->urlManager->setAppLanguage();
+}
+~~~
View
17 protected/views/site/imageHandler.php
@@ -50,4 +50,21 @@
<tr>
<td><?php echo CHtml::image(Yii::app()->createUrl('imageHandler/watermark')); ?></td>
</tr>
+</table>
+
+<h2>PNG</h2>
+
+<table style="background: #f00;">
+ <tr>
+ <td><?php echo CHtml::image(Yii::app()->createUrl('imageHandler/pngWatermark')); ?></td>
+ <td><?php echo CHtml::image(Yii::app()->createUrl('imageHandler/pngWatermark2')); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo CHtml::image(Yii::app()->createUrl('imageHandler/pngWatermark3')); ?></td>
+ <td><?php echo CHtml::image(Yii::app()->createUrl('imageHandler/pngWatermark4')); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo CHtml::image(Yii::app()->createUrl('imageHandler/pngWatermark5')); ?></td>
+ <td><?php echo CHtml::image(Yii::app()->createUrl('imageHandler/pngWatermark6')); ?></td>
+ </tr>
</table>
Please sign in to comment.
Something went wrong with that request. Please try again.