Reputation: 286
I have a page where we can change our profile picture just like in twitter. But when I change the profile picture, the image is not refreshed. I have used the same controller to change and render the page. I need to hit F5 button to see the image has been changed.
For Instance: the page is setting/profile, when we save the image the same controller/action is called and the same view is rendered but the image does not refresh.
How do I get this thing work? I have tried javascript, tried redirect nothing seem to work. I can only see it work while hitting F5 button manually.
Any suggestion or solution is greatly appreciated.
Thanks,
Upvotes: 0
Views: 1723
Reputation: 1097
Here is an example you could use in your view.
echo CHtml::image(Yii::app()->request->baseUrl."/images/profile_pic$user_id.png?_=".time(), 'Profile Pic');
Upvotes: 3