Skip to content

Instantly share code, notes, and snippets.

@mneuhaus
Created August 28, 2015 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mneuhaus/48a990703d44e0816a6d to your computer and use it in GitHub Desktop.
Save mneuhaus/48a990703d44e0816a6d to your computer and use it in GitHub Desktop.
function to remove process variants of an fal image
<?php
public function clearProcessedImages($fileUid) {
$processedFiles = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_file_processedfile', 'original = ' . $fileUid, 'identifier');
foreach ($processedFiles as $processedFile) {
$storage = $this->storageRepository->findByUid($processedFile['storage']);
$configuration = $storage->getConfiguration();
$path = realpath($configuration['basePath'] . $processedFile['identifier']);
unlink($path);
}
$GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_file_processedfile', 'original = ' . $image['uid']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment