Cache Problem?

Hi All,

I’m getting crazy with this problem, I have no idea how to solve it, let me explain…

I have a grid where there is a list of images, in each row there is thumb as preview image and a button to crop to let the user crop the image. When the user crop the image I also generate a new thumb from the image already cropped and I overwrite the images by saving them with the same name.

After the image is cropped, I refresh the grid by renderPartial, the problem is that the thumb isn’t refreshed, I don’t know if it’s a cache problem or something like this because I save the image with the same name it had before. It only works if I refresh the entire page, the renderPartial works fine because I have tried to render other view and it works.

Here is my code:


//Crop from the orginal file and save it in different folder

		    if( is_file( $originalFile ) ) {

			    $fileCropped = Yii::app()->phpThumb->create($originalFile);




                chmod( $file, 0777 );


			//Overwrite the current thumb with the one from the already cropped image

			if( is_file( $thumbFile ) ) {			






			echo $this->renderPartial('/postimage/_upload', array('model'=>$model->images, 'post_id'=>$model->id), true, false);

The script:


$('body').on('click', '#bt-crop', function(event){

		var form = $('#crop-form');

		var post = { };


			var name = $(this).attr('name');

			var value = $(this).val();

			post[name] = value;


		var opts = {

			url: $(this).attr('href'),

			data: post,

			cache: false, 

			async: true, 

			type: 'POST', 

			success: function(data){




			,error: function(e){








The whole process works, except the thumb image isn’t refreshed and I don’t know why, I would really appreciate some help on this.


We can manage the caching in protected/config/main.php file

First check from which path the image is loaded. for example /assets/…

then add this line of code



          'your image path'=&gt;false,



hope this might solve your problem.

Thanks, the thing is that the path is dynamic, so I only know the path in runtime. I have realized that in Chrome it works, just sometimes not always, but in Firefox it never works. I don’t even know if it’s a cache problem or it’s related to another cause.