public function deleteImageVariations($user, $imageIdentifier, $width = null)
{
// If width is specified, delete only the specific image
if ($width !== null) {
return unlink($this->getImagePath($user, $imageIdentifier, $width, true));
}
// If width is not specified, delete every variation, then the folder
$variationsPath = $this->getImagePath($user, $imageIdentifier);
if (!is_dir($variationsPath)) {
return false;
}
array_map('unlink', glob($variationsPath . '/*'));
return rmdir($variationsPath);
}