Skip to content

Commit

Permalink
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Command.php
Original file line number Diff line number Diff line change
@@ -66,7 +66,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$oResult = $oParser->parse($sUrl);
$iNbUrl > 1 && $output->isVerbose() && $progress->advance();
if (!$oResult) {
throw new \DomainException("Error while parsing $sUrl");
throw new \DomainException(
"Unable to parse $sUrl." . PHP_EOL .
"Consider creating an issue on " .
"https://github.com/jaymoulin/yamete/issues/"
);
}
$this->download($oResult, $output);
$output->writeln("<info>Download $sUrl success!</info>");
4 changes: 2 additions & 2 deletions src/PDF.php
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ private function resizeToFit($imgFilename)
list($width, $height) = getimagesize($imgFilename);
$width = $this->pixelsToMM($width);
$height = $this->pixelsToMM($height);
$widthScale = self::MAX_WIDTH / $width;
$heightScale = self::MAX_HEIGHT / $height;
$widthScale = self::MAX_WIDTH / ($width ?: 1);
$heightScale = self::MAX_HEIGHT / ($height ?: 1);
$scale = min($widthScale, $heightScale);
return $width > $height
? [round($scale * $width), round($scale * $height)]

0 comments on commit 78fccaa

Please sign in to comment.