Show error when createPreview fails
This commit is contained in:
parent
e54522c3f8
commit
31c0bda8cb
@ -20,7 +20,13 @@ echo '<body>';
|
|||||||
foreach ($SITE->modules->Books()->listAll() as $book)
|
foreach ($SITE->modules->Books()->listAll() as $book)
|
||||||
{
|
{
|
||||||
echo 'Create preview for ' . $book['title'] . '<br/>' . "\n";
|
echo 'Create preview for ' . $book['title'] . '<br/>' . "\n";
|
||||||
|
|
||||||
|
try {
|
||||||
$SITE->modules->Books()->createPreview($book);
|
$SITE->modules->Books()->createPreview($book);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo '<strong>Failed to create preview for ' . $book['title'] . ':' . $e->getMessage() . '</strong><br/>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
echo 'Finished.' . '<br/>' . "\n";
|
echo 'Finished.' . '<br/>' . "\n";
|
||||||
|
|
||||||
|
@ -20,7 +20,13 @@ echo '<body>';
|
|||||||
foreach ($SITE->modules->Programs()->listAll() as $prog)
|
foreach ($SITE->modules->Programs()->listAll() as $prog)
|
||||||
{
|
{
|
||||||
echo 'Create preview for ' . $prog['name'] . '<br/>' . "\n";
|
echo 'Create preview for ' . $prog['name'] . '<br/>' . "\n";
|
||||||
|
|
||||||
|
try {
|
||||||
$SITE->modules->Programs()->createPreview($prog);
|
$SITE->modules->Programs()->createPreview($prog);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo '<strong>Failed to create preview for ' . $prog['name'] . ':' . $e->getMessage() . '</strong><br/>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
echo 'Finished.' . '<br/>' . "\n";
|
echo 'Finished.' . '<br/>' . "\n";
|
||||||
|
|
||||||
|
@ -176,7 +176,12 @@ function magick_resize_image($file, $width, $height, $output)
|
|||||||
|
|
||||||
$cmd = 'convert "' . $file . '" -strip -resize ' . $final_width . 'x' . $final_height . ' "' . $output . '"';
|
$cmd = 'convert "' . $file . '" -strip -resize ' . $final_width . 'x' . $final_height . ' "' . $output . '"';
|
||||||
|
|
||||||
shell_exec($cmd);
|
$output=null;
|
||||||
|
$retval=null;
|
||||||
|
$r = exec($cmd, $output, $retval);
|
||||||
|
|
||||||
|
if ($r === false) throw new Exception("Magick exec() return FALSE");
|
||||||
|
if ($retval !== 0) throw new Exception("Magick exec() returned exitcode $retval");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMail($subject, $content, $to, $from)
|
function sendMail($subject, $content, $to, $from)
|
||||||
|
Loading…
Reference in New Issue
Block a user