Доработка медиа - перегенерация превью
This commit is contained in:
parent
3ec7342ef2
commit
558119c87d
|
@ -1149,6 +1149,38 @@ class ModuleMedia extends ModuleORM
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Перегенерация всех превью
|
||||
*
|
||||
* @param array|string|null $aTypes Список типов для перегенерации
|
||||
*/
|
||||
public function ReCreateFilePreviewAll($aTypes = null)
|
||||
{
|
||||
$iPage = 1;
|
||||
$aFilter = array(
|
||||
'is_preview' => 1,
|
||||
'target_id <>' => null,
|
||||
'#with' => array('media'),
|
||||
'#page' => array($iPage, 100)
|
||||
);
|
||||
if ($aTypes) {
|
||||
if (!is_array($aTypes)) {
|
||||
$aTypes = array($aTypes);
|
||||
}
|
||||
$aFilter['target_type in'] = $aTypes;
|
||||
}
|
||||
|
||||
while ($aRes = $this->GetTargetItemsByFilter($aFilter) and $aRes['collection']) {
|
||||
foreach ($aRes['collection'] as $oTarget) {
|
||||
if ($oMedia = $oTarget->getMedia()) {
|
||||
$this->CreateFilePreview($oMedia, $oTarget);
|
||||
}
|
||||
}
|
||||
$iPage++;
|
||||
$aFilter['#page'][0] = $iPage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Создает превью у файла для определенного типа
|
||||
*
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8b2b455b5efe9055e934576bd9cfa0f103173e6b
|
||||
Subproject commit d8082f10ab01ba1fd9d30316378a392a1dc9dd55
|
Loading…
Reference in New Issue