execute an action using <img /> tag


in my view :

<img src="'.Yii::app()->controller->createUrl('key-image', array('id'=>'image.jpg')).'">

I want to call an action to return the content of an image I tried with :

Yii::app()->controller->createUrl('key-image', array('id'=>'image.jpg'))

But it’s not working.

this is my UrlManager.php

 $this->addRoute('key-image', 'images/<id:>', 'image/getImage', false);

is there any other way to do that ?

Thank you in advance

Morning Maher,

The right way is:

<img src="<?php echo Yii::app()->request->baseUrl; ?>/ exemplo/image.jpg">

I think you want a link like this:


you have to put a class type within a imagensize action

Here what i found maybe it will help for others