components/behaviors/ImageBehavior.php
public function unlinkFiles($fileName)
    {
        $folder = $this->getWebrootFolder();

        if ($fileName) {
            if (@file_exists($folder . '/' . $fileName)) {
                unlink($folder . '/' . $fileName);
            }
            if (@file_exists($folder . '/' . $this->thumbFolder . '/' . $fileName)) {
                unlink($folder . '/' . $this->thumbFolder . '/' . $fileName);
            }
            if (is_array($this->sizes)) {
                $i = 0;
                foreach ($this->sizes as $size) {
                    if (@file_exists($folder . '/' . $i . '/' . $fileName)) {
                        unlink($folder . '/' . $i . '/' . $fileName);
                    }
                    $i++;
                }
            }
        }
    }
public function unlinkFiles($fileName)
    {
        $folder = $this->getWebrootFolder();

        if ($fileName) {
            if (@file_exists($folder . '/' . $fileName)) {
                unlink($folder . '/' . $fileName);
            }
            if (@file_exists($folder . '/' . $this->thumbFolder . '/' . $fileName)) {
                unlink($folder . '/' . $this->thumbFolder . '/' . $fileName);
            }
            if (is_array($this->sizes)) {
                $i = 0;
                foreach ($this->sizes as $size) {
                    if (@file_exists($folder . '/' . $i . '/' . $fileName)) {
                        unlink($folder . '/' . $i . '/' . $fileName);
                    }
                    $i++;
                }
            }
        }
    }
Helper function for unlink files
@param $fileName