hello all I’m trying this extension.

I wrote in the view that the controller is what the author said, but I have this error.

Undefined index: idOrAttributeName_x 

if i comment the controller, i see the image with the selection, than the image is found.


me too having the same issue , somebody please help

And I have this problem.

Anyone can help?

i have also same pblm anyone knows pls help me


You have to pass the attribute name. I hope this will solve your problem…



	 * Get the cropping coordinates from post.


	 * @param type $attribute The model attribute name used.

	 * @return array Cropping coordinates indexed by : x, y, h, w


	public function getCoordsFromPost($attribute)


		$coords = array('x' => null, 'y' => null, 'h' => null, 'w' => null);

		foreach ($coords as $key => $value) {

			$coords[$key] = $_POST[$attribute . '_' . $key];


		return $coords;


Thank u for ur reply chandran,I understand the syntax but if i gave my attribute name it throw the error undefined index:****

If u have any example in ur code or anything else pls show me…


check this





I hope this will help :)

Hi chandran,

if u don’t mind please check my code is it crt or not.


public function actionUpdate($id)




	$profilePic = 'shadow.png';





		$rnd = rand(0,9999);  // generate random number between 0-9999


	if($uploadedFile!=null) {

   			$fileName = "{$rnd}-{$uploadedFile}";  // random number + file name

    			$model->profilepic = $fileName;



		if($model->save()&&$valid_format) {

			if(!empty($uploadedFile)) {



			$jcropper = new EJCropper();

			$jcropper->thumbPath = Yii::app()->basePath.'/../images/Editimage/'.$fileName;


			// some settings ...

			$jcropper->jpeg_quality = 95;

			$jcropper->png_compression = 8;


			// get the image cropping coordinates (or implement your own method)

			$coords = $jcropper->getCoordsFromPost('uploadPreview');


			// returns the path of the cropped image, source must be an absolute path.

			$thumbnail = $jcropper->crop(Yii::app()->basePath.'/../images/thumbs/', $coords);	








	$this->profileInfo = $this->renderPartial('profileInfo',array('model'=>$model),true);







$this->widget(‘ext.jcrop.EJcrop’, array(


// Image URL

'url' =&gt; Yii::app()-&gt;baseUrl.'/images/Editimage/'.&#036;model-&gt;profilepic,


// ALT text for the image

'alt' =&gt; 'Crop This Image',


// options for the IMG element

'htmlOptions' =&gt; array('id' =&gt; 'uploadPreview','onclick'=&gt;&quot;return image();&quot;),


// Jcrop options (see Jcrop documentation)

'options' =&gt; array(

	'minSize' =&gt; array(50, 50),

	'aspectRatio' =&gt; 1,

	'onRelease' =&gt; &quot;js:function() {ejcrop_cancelCrop(this);}&quot;,


// if this array is empty, buttons will not be added

'buttons' =&gt; array(

	'start' =&gt; array(

    	'label' =&gt; Yii::t('promoter', 'Adjust thumbnail cropping'),

    	'htmlOptions' =&gt; array(

        	'class' =&gt; 'myClass',

        	'style' =&gt; 'color:red;', // make sure style ends with « ; »



	'crop' =&gt; array(

    	'label' =&gt; Yii::t('promoter', 'Apply cropping'),


	'cancel' =&gt; array(

    	'label' =&gt; Yii::t('promoter', 'Cancel cropping')



// URL to send request to (unused if no buttons)

'ajaxUrl' =&gt; Yii::app()-&gt;createAbsoluteUrl('user/update&amp;id='.(&#036;model-&gt;id)),


// Additional parameters to send to the AJAX call (unused if no buttons)

'ajaxParams' =&gt; array('someParam' =&gt; 'someValue'),



[size=2]Hi shobana,[/size]



Your code looks fine. But i cannot comment on your code without knowing outcome …

what is the result with above code ?

ithe image display with cropping option but the cropped image can’t save in thumbs folder


please can you check in your code… whether code reaches after this if condition :(

I dont think it reaches this level :)


[color="#1C2837"][size="2"]if($model->save()&&$valid_format) {[/size][/color]

The original image save in the editimage folder under the if condition but the cropped image does not saved…


Have you tried printing this value…


[color=#1C2837][size=2]what is the name… are you getting?[/size][/color]

This link also not working chandran…I downloaded that file and implemented using same file…this is also not save cropped image folder

the printing value is: bool(false); now wat i have to do


Dont worry

Goto this file EJCropper.php

Goto crop method. that is the method responsible for saving

there you have try print_r($src)


then there is so many if else… just try debugging those code…

i am sure u will get output today… cheers :)

thank you chandran…

How to debug the code… please tell me

Reply has been delivered to your question… please check mail