/**
  * Method to update images name/description via AJAX.
  * On success returns JSON array of objects with new image info.
  *
  * @param $imagesData
  *
  * @throws HttpException
  * @return string
  */
 public function actionChangeData($imagesData)
 {
     if (count($imagesData) == 0) {
         throw new HttpException(400, 'Nothing to save');
     }
     $images = $this->behavior->updateImagesData($imagesData);
     $resp = array();
     foreach ($images as $model) {
         $resp[] = array('id' => $model->id, 'rank' => $model->rank, 'preview' => $model->getUrl('preview'));
     }
     return Json::encode($resp);
 }
 /**
  * @param string $version
  *
  * @return string
  */
 public function getUrl($version)
 {
     return $this->galleryBehavior->getImageUrl($this, $version);
 }