Yii Framework Forum: Redactor Upload Image - Yii Framework Forum

Jump to content

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

Redactor Upload Image Rate Topic: -----

#1 User is offline   fatjedi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 10-December 12

Posted 10 December 2012 - 10:05 PM

Hi,
I would like to know anyone know how to use redactor image upload?Is there any example?
0

#2 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 11 December 2012 - 03:23 AM

Hi,

look at janisto's ycm module.
He has implemented a nice "universal" (meaning that you can call it for all your models/attribute that are defined as text in your db) way to use redactor with the upload feature.
here is source code.
Hey Ho !
Let's go !
0

#3 User is offline   janisto 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 30-March 11
  • Location:Helsinki, Finland

Posted 12 December 2012 - 01:36 PM

I just committed easy to use actions for Redactor widget.

Check out https://github.com/j...to/yii-redactor

Modify the actions to your own taste.
1

#4 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 12 December 2012 - 04:27 PM

View Postjanisto, on 12 December 2012 - 01:36 PM, said:

I just committed easy to use actions for Redactor widget.

Check out https://github.com/j...to/yii-redactor

Modify the actions to your own taste.


Looks good.
Thank you
Hey Ho !
Let's go !
0

#5 User is offline   wadim 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 19-March 13

Posted 11 June 2013 - 08:11 AM

I'm trying to upload images using this actions from github (https://github.com/j.../master/actions)

And a uploads folder is created with the image in it, and in the textarea I'm getting this:
>>>{"filelink":"\/uploads\/file\/content\/d4d8f1c6db38315b1b7cff06e62228cb.png"}

Is this how it should work, or am i missing something ?
0

#6 User is offline   janisto 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 30-March 11
  • Location:Helsinki, Finland

Posted 12 June 2013 - 07:37 AM

Are you using file or image upload action?
How did you configure the controller and view?
0

#7 User is offline   Amjad Khan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-November 11

Posted 09 November 2013 - 07:58 AM

Hi janisto
i am using this code in my view(_form)
      $attribute='description';
        Yii::import('ext.imperavi-redactor-widget.ImperaviRedactorWidget');
        $this->widget('ImperaviRedactorWidget', array(
            // You can either use it for model attribute
            'model' => $model,
            'attribute' =>$attribute,
            // or just for input field
          

            'name' => 'description',
            // Some options, see http://imperavi.com/redactor/docs/
            'options' => array(
                'fileUpload' => Yii::app()->createUrl('post/fileUpload', array(
                    'attr' => $attribute,
                )),
                'fileUploadErrorCallback' => new CJavaScriptExpression(
                        'function(obj,json) { alert(json.error); }'
                ),
                'imageUpload' => Yii::app()->createUrl('post/imageUpload', array(
                    'attr' => $attribute,
                )),
                'imageUploadErrorCallback' => new CJavaScriptExpression(
                        'function(obj,json) { alert(json.error); }'
                ),
            ),
        ));
        ?>

and following code in my controller
 public function actions()
    {
        return array(
            
            'fileUpload'=>array(
                'class'=>'ext.imperavi-redactor-widget.ImperaviRedactorWidget.actions.FileUpload',
                'uploadPath'=>Yii::getPathOfAlias('webroot').'/uploads',
                'uploadUrl'=>Yii::getPathOfAlias('webroot').'/uploads',
                'uploadCreate'=>true,
                'permissions'=>0755,
            ),
            'imageUpload'=>array(
                'class'=>'ext.imperavi-redactor-widget.ImperaviRedactorWidget.actions.ImageUpload',
                'uploadPath'=>Yii::getPathOfAlias('webroot').'/uploads',
                'uploadUrl'=>Yii::getPathOfAlias('webroot').'/uploads',
                'uploadCreate'=>true,
                'permissions'=>0755,
            ),

        );
    }

but i got this error
-----------------------------------------------------
SyntaxError: JSON.parse: expected property name or '}'
return window.JSON.parse( data );
-------------------------------------------------------
please help me where i m wrong...sorry for my poor English
0

#8 User is offline   Haris N H 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 03-January 14

Posted 03 January 2014 - 07:08 AM

Hi Amjad,

I have faced the same issue and fixed.

Do you have a folder named "actions" in extensions/imperavi-redactor-widget ?

If not you can download it from the link provided by janisto above

That will fix your issue
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