Added script for batch thumbnail generating
This commit is contained in:
parent
9e2f37477b
commit
326e7acb4b
1 changed files with 20 additions and 0 deletions
20
scripts/generate-thumbs.php
Normal file
20
scripts/generate-thumbs.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/../src/core.php';
|
||||
|
||||
Access::disablePrivilegeChecking();
|
||||
|
||||
array_shift($argv);
|
||||
|
||||
$query = array_shift($argv);
|
||||
$posts = PostSearchService::getEntities($query, null, null);
|
||||
$entityCount = PostSearchService::getEntityCount($query, null, null);
|
||||
$i = 0;
|
||||
foreach ($posts as $post)
|
||||
{
|
||||
++ $i;
|
||||
printf('%s (%d/%d)' . PHP_EOL, TextHelper::reprPost($post), $i, $entityCount);
|
||||
if (!$post->tryGetWorkingThumbPath())
|
||||
$post->generateThumb();
|
||||
}
|
||||
|
||||
echo 'Don\'t forget to check access rights.';
|
Loading…
Reference in a new issue