Commit 5ad0b236 authored by SpinShare's avatar SpinShare

thumbnail fix

parent 5c3daae2
......@@ -24,4 +24,5 @@
/public/uploads/promo/
/public/uploads/avatar/
/public/uploads/client/
/public/uploads/thumbnail/
###< customspeens-server ###
\ No newline at end of file
......@@ -91,4 +91,39 @@ class SystemController extends AbstractController
return $this->redirectToRoute('moderation.system.index');
}
/**
* @Route("/moderation/system/generate/thumbnails-missing", name="moderation.system.generate.thumbnails-missing")
*/
public function systemGenerateMissingThumbnails(Request $request)
{
$em = $this->getDoctrine()->getManager();
$baseUrl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
$allSongs = $em->getRepository(Song::class)->findAll();
try {
foreach($allSongs as $oneSong) {
$filePath = glob($this->getParameter('cover_path').DIRECTORY_SEPARATOR.$oneSong->getFileReference().".png");
$existingThumbnail = glob($this->getParameter('thumbnail_path').DIRECTORY_SEPARATOR.$oneSong->getFileReference().".jpg");
if(count($existingThumbnail) == 0) {
if(count($filePath) > 0) {
$hf = new HelperFunctions();
$hf->generateThumbnail($filePath[0], $this->getParameter('thumbnail_path').DIRECTORY_SEPARATOR.$oneSong->getFileReference().".jpg", 300);
echo "Generating: ".$oneSong->getFileReference()."<br />";
}
} else {
echo "Skipping: ".$oneSong->getFileReference()."<br />";
}
}
} catch(\Exception $e) {
var_dump($e);
exit;
}
exit;
return $this->redirectToRoute('moderation.system.index');
}
}
......@@ -14,7 +14,7 @@
<div class="box">
Generate On All Songs Actions<br /><strong>(ATTENTION: They can take a while!)</strong><br /><br />
<a href="{{ path('moderation.system.generate.thumbnails') }}" class="button">Generate Thumbnails</a><br /><br />
<a href="{{ path('moderation.system.generate.thumbnails') }}" class="button">Generate Thumbnails</a> <a href="{{ path('moderation.system.generate.thumbnails-missing') }}" class="button">Generate Missing Thumbnails</a><br /><br />
<a href="{{ path('moderation.system.cleanup.temp') }}" class="button">Cleanup Temp Folder</a>
</div>
</section>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment