Yii Framework Forum: Yii-Redactor Or Imperaviredactorwidget? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii-Redactor Or Imperaviredactorwidget? Rate Topic: -----

#1 User is offline   Wilbo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 52
  • Joined: 06-September 13

Posted 09 October 2013 - 05:51 AM

Hi there,

I'm trying to get redactor to work with image upload but I don't know if I need to use Yii-redactor or not.
I've got redactor working (without image upload) using ImperaviRedactorWidget but I can't get Yii-redactor to do anything at all.

Do I need yii-redactor to implement image upload functionality or can I do it with ImperaviRedactorWidget?

Any advice would be greatly appreciated.

Thanks in advance.
0

#2 User is offline   Wilbo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 52
  • Joined: 06-September 13

Posted 09 October 2013 - 09:34 AM

OK, does anyone have any tips about getting the image upload to work?

Here is what I have so far:

I have downloaded ImperaviRedactorWidge and extracted into the extensions folder.
I have done the same for RedactorUploadAction

In the view:
Yii::import('ext.imperavi-redactor-widget.ImperaviRedactorWidget');
				$this->widget('ImperaviRedactorWidget',array(
					// you can either use it for model attribute
					'model'=>$model,
					'attribute'=>'description',
					// or just for input field
					//'name'=>'my_input_name',
					// imperavi redactor [options](http://imperavi.ru/redactor/docs/)
					'options'=>array(
						'toolbar'=>'classic',
						'cssPath'=>Yii::app()->theme->baseUrl.'/css/',
						'imageUpload'=>$this->createUrl('property/imgUpload'),
        				'imageUploadErrorCallback'=>'js:function(obj, json){ alert(json.error); }', // function to show upload error to user
					),
				));


In the controller I have created the action() function:
public function actions()
    {
                return array(
                        'imgUpload'=>array(
							'class' => 'ext.redactor-upload-action.RedactorUploadAction',
							'directory'=>'/uploads/images/',
							'validator'=>array(
								'mimeTypes' => array('image/png', 'image/jpg', 'image/gif', 'image/jpeg', 'image/pjpeg'),
							)
						),
                );
    }


The redactor editor renders fine in the view but when I try to upload an image the Insert Image box appears, I click choose file to browse to my computer but when I select a file nothing appears in the Insert Image box. The Console says:

Quote

POST http://localhost/hol...perty/imgUpload 500 (Internal Server Error)


There is a thread here from last year with the same issue but no solution.

Any ideas?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users