From 238fa522feafe6ce2994996009aef7e1cae9d06d Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Mon, 22 Jan 2018 10:39:22 +0100 Subject: [PATCH] Image pathname can be URL not only local file location --- src/Passbook/PassFactory.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Passbook/PassFactory.php b/src/Passbook/PassFactory.php index fed3153..9c789c7 100644 --- a/src/Passbook/PassFactory.php +++ b/src/Passbook/PassFactory.php @@ -479,7 +479,7 @@ private function preparePassDirectory(PassInterface $pass) /** * @param PassInterface $pass - * @param $passDir + * @param string $passDir */ private function prepareImages(PassInterface $pass, $passDir) { @@ -491,14 +491,16 @@ private function prepareImages(PassInterface $pass, $passDir) } else if ($image->getDensity() === 3) { $fileName .= '@3x'; } - $fileName .= '.' . $image->getExtension(); + + // Image pathname can be URL not only local file location + $fileName .= '.' . pathinfo(parse_url($image->getPathname(), PHP_URL_PATH), PATHINFO_EXTENSION); copy($image->getPathname(), $fileName); } } /** * @param PassInterface $pass - * @param $passDir + * @param string $passDir */ private function prepareLocalizations(PassInterface $pass, $passDir) { @@ -524,6 +526,4 @@ private function prepareLocalizations(PassInterface $pass, $passDir) } } } - - }