fix:修复BUG/升级1.1.6版本
This commit is contained in:
@@ -8,13 +8,10 @@ use Endroid\QrCode\Label\LabelInterface;
|
||||
|
||||
class LabelImageData
|
||||
{
|
||||
private int $width;
|
||||
private int $height;
|
||||
|
||||
private function __construct(int $width, int $height)
|
||||
{
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
private function __construct(
|
||||
private int $width,
|
||||
private int $height
|
||||
) {
|
||||
}
|
||||
|
||||
public static function createForLabel(LabelInterface $label): self
|
||||
|
||||
@@ -8,31 +8,14 @@ use Endroid\QrCode\Logo\LogoInterface;
|
||||
|
||||
class LogoImageData
|
||||
{
|
||||
private string $data;
|
||||
|
||||
/** @var mixed */
|
||||
private $image;
|
||||
|
||||
private string $mimeType;
|
||||
private int $width;
|
||||
private int $height;
|
||||
private bool $punchoutBackground;
|
||||
|
||||
/** @param mixed $image */
|
||||
private function __construct(
|
||||
string $data,
|
||||
$image,
|
||||
string $mimeType,
|
||||
int $width,
|
||||
int $height,
|
||||
bool $punchoutBackground
|
||||
private string $data,
|
||||
private \GdImage|null $image,
|
||||
private string $mimeType,
|
||||
private int $width,
|
||||
private int $height,
|
||||
private bool $punchoutBackground
|
||||
) {
|
||||
$this->data = $data;
|
||||
$this->image = $image;
|
||||
$this->mimeType = $mimeType;
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
$this->punchoutBackground = $punchoutBackground;
|
||||
}
|
||||
|
||||
public static function createForLogo(LogoInterface $logo): self
|
||||
@@ -89,10 +72,9 @@ class LogoImageData
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/** @return mixed */
|
||||
public function getImage()
|
||||
public function getImage(): \GdImage
|
||||
{
|
||||
if (null === $this->image) {
|
||||
if (!$this->image instanceof \GdImage) {
|
||||
throw new \Exception('SVG Images have no image resource');
|
||||
}
|
||||
|
||||
@@ -126,10 +108,7 @@ class LogoImageData
|
||||
|
||||
private static function detectMimeTypeFromUrl(string $url): string
|
||||
{
|
||||
/** @var mixed $format */
|
||||
$format = PHP_VERSION_ID >= 80000 ? true : 1;
|
||||
|
||||
$headers = get_headers($url, $format);
|
||||
$headers = get_headers($url, true);
|
||||
|
||||
if (!is_array($headers) || !isset($headers['Content-Type'])) {
|
||||
throw new \Exception(sprintf('Content type could not be determined for logo URL "%s"', $url));
|
||||
|
||||
Reference in New Issue
Block a user