CropperjsWidget.php 692 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\widgets;
  3. use yii\base\Widget;
  4. use yii\helpers\Html;
  5. class CropperjsWidget extends Widget
  6. {
  7. public $image;
  8. public $file;
  9. public $post;
  10. public $aspectRatio;
  11. public function init()
  12. {
  13. parent::init();
  14. if ($this->image === null) {
  15. $this->image = 'image';
  16. }
  17. if ($this->file === null) {
  18. $this->file = 'photo';
  19. }
  20. if ($this->post === null) {
  21. $this->post = 'cropper';
  22. }
  23. if ($this->aspectRatio === null) {
  24. $this->aspectRatio = '16/9';
  25. }
  26. }
  27. public function run()
  28. {
  29. return $this->render('cropperjswidget/modal');;
  30. }
  31. }