public function uploadGallery(){
if($this->validate()){
foreach($this->gallery as $file){
$path = 'upload/store/'.$file->baseName . '.' . $file->extension;
$file->saveAs($path);
Image::resize($path, 800, 800)
->save(($path), ['quality' => 80]);
$this->attachImage($path);
@unlink($path);
}
return true;
}else{
return false;
}
}
public function init()
{
$this->addForeignKey('fk-adverts-image_id', '{{%image}}', 'itemId', 'id', '{{%adverts}}', 'CASCADE', 'RESTRICT');
}
public function actionDelete($id)
{
$model = $this->findModel($id);
if($model->delete()){
$model->unlinkAll('image', true);
$path_to_dir = 'web/upload/store/Adverts/Adverts'.$id;
FileHelper::removeDirectory($path_to_dir);
}
return $this->redirect(['advbyuser']);
}
public function actionDelete($id)
{
if($this->findModel($id)->delete()){
FileHelper::removeDirectory($path_to_dir);
}
return $this->redirect(['advbyuser']);
}
public function getImage(){
return $this->hasOne(Image::className(), ['itemId' => 'id']);
}
Error: reCAPTCHA has already been rendered in this element recaptcha__ru.js:581:37
qD
https://www.gstatic.com/recaptcha/api2/v1546842739564/recaptcha__ru.js:581:37
recaptchaOnloadCallback/<
http://lechenie-v-kitae.info/contact.html:299:37
each
http://lechenie-v-kitae.info/assets/4e007f3a/jquery.js:362:10
each
http://lechenie-v-kitae.info/assets/4e007f3a/jquery.js:157:10
recaptchaOnloadCallback
http://lechenie-v-kitae.info/contact.html:296:28
IH
https://www.gstatic.com/recaptcha/api2/v1546842739564/recaptcha__ru.js:588:65
h
https://www.gstatic.com/recaptcha/api2/v1546842739564/recaptcha__ru.js:583:291