Skip to content

[BUG] No work $options->bgColor #293

@alex-l-iwpdev

Description

@alex-l-iwpdev

Issue description

Lots of questions
1 I can't set the background color for PNG
2 I can't choose the size normally, for example 500x500

Expected behavior

Qr code PNG 500x500 with black background and for example white Qr

Code sample

$options                    = new QROptions;
		$options->version           = 7;
		$options->outputType        = QROutputInterface::IMAGICK;
		$options->imagickFormat     = 'png';
		$options->bgColor           = '#000000';
		$options->transparencyColor = '#000000';
		$options->outputBase64      = false;
		$options->eccLevel          = QRCode::ECC_L;
		$options->quality           = 90;
		$options->scale             = 10;
		$options->outputBaseSize    = 50;
		$options->imageTransparent  = false;

		if ( ! empty( $qr_option ) ) {
			$options->moduleValues = [
				QRMatrix::M_DARKMODULE     => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_SEPARATOR_DARK => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_TIMING_DARK    => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_FORMAT_DARK    => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_VERSION_DARK   => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_QUIETZONE_DARK => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_LOGO_DARK      => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_DATA_DARK      => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_FINDER_DARK    => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_ALIGNMENT_DARK => $qr_option['color']['text'] ?? '#000000',
				QRMatrix::M_FINDER_DOT     => $qr_option['color']['text'] ?? '#000000',
			];
		}

		try {
			( new QRCode( $options ) )->render( $string_url, $file_path );
		} catch ( Throwable $e ) {
			return [
				'error'   => true,
				'message' => $e->getMessage(),
			];
		}

Library version

latest

Additional context

why is there no normal resize function that accepts exact sizes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions