This commit is contained in:
2025-10-04 11:46:59 +07:00
commit 97427d7cff
498 changed files with 47596 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace Hura8\Components\Media\AdminController;
use Hura8\Components\Media\Controller\bItemMediaController;
use Hura8\Interfaces\iEntityAdminController;
use Hura8\Traits\AdminEntityBaseControllerTraits;
class AItemMediaController extends bItemMediaController implements iEntityAdminController
{
use AdminEntityBaseControllerTraits;
protected function deleteFileBeforeDeleteItem($item_id): bool
{
// delete thumb files
$item_info = $this->getInfo($item_id);
if(!$item_info['file_url']) {
return true;
}
$file_name = $item_info['file_url'];
foreach (static::$resized_sizes as $size => $value) {
$file_local_path = PUBLIC_DIR . "/". static::$image_folder . "/". $size. IMAGE_FILE_SEPARATOR . $file_name;
@unlink($file_local_path);
}
// remove original file
$file_local_path = PUBLIC_DIR . "/". static::$image_folder . "/". $file_name;
@unlink($file_local_path);
return true;
}
}