コード例 #1
0
ファイル: ImageBehave.php プロジェクト: jumper423/yii2-images
 /**
  *
  * removes concrete model's image
  * @param Image $img
  * @throws \Exception
  */
 public function removeImage(Image $img)
 {
     $img->clearCache();
     $storePath = $this->getModule()->getStorePath();
     $fileToRemove = $storePath . DIRECTORY_SEPARATOR . $img->filePath;
     if (preg_match('@\\.@', $fileToRemove) and is_file($fileToRemove)) {
         unlink($fileToRemove);
     }
     $img->delete();
 }