Hide image path

Is there a good way to hide path using Yii?


Yii::app()->createUrl("site/image",array('test'=>'test'),"&");

You already hide basePath by preferring createUrl over createAbsoluteUrl. Or did you mean something else?

Thanks pestaa. :)

I want something like that : <img src="index.php?some/action&attributes=hideimage" />

Look over my $_GET array in hide image action:


Array ( [r] => site/image [amp;act] => permissionario [amp;id] => 1 ) 

How can I fix it?

CHtml offers some simple methods to generate tags.

What piece of code does generate such input?

CHtml image or tag? :) I am trying to get back an image through script.


<img src="index.php?some/action&attributes=hideimage" />


print_r( $_GET )


Array ( [r] => site/image [amp;act] => permissionario [amp;id] => 1 ) 

Is it an encode problem? [amp;id]

W3c - Ampersands in URI attribute values

I see, so <img src="index.php?some/action&attributes=hideimage" /> is not an example but the actual code.

some/action should be passed as r. Instead it is now only appended to the url.

Try




<img src="index.php?r=some/action&attributes=hideimage" />



Sorry for my mistake.

My doubt is : how to get an image through script?

My real code:


<?php print CHtml::image(Yii::app()->createAbsoluteUrl("site/image",array("act"=>"permissionario","id"=>$form->permissionarioId)),'',array('encode'=>false)); ?>

CHtml::image() only creates an image tag. You have to read that image (from db or filesystem) and simply echo it with proper headers.

I got it! Thank you!