Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having data passed from PHP, how can we handle the file? #65

Open
realtebo opened this issue Aug 6, 2021 · 0 comments
Open

Having data passed from PHP, how can we handle the file? #65

realtebo opened this issue Aug 6, 2021 · 0 comments

Comments

@realtebo
Copy link

realtebo commented Aug 6, 2021

I've this snippet reading a png

   <?php
        $file_name = './ReactNative-snapshot-image6513693026486043647.png';
        $image_file_content = base64_encode(file_get_contents( $file_name ));

        $image_size = getimagesize( $file_name );
    ?>

I need to convert the png to a Uint8ClampedArray (to decode a QRCode client-side, long story)

Is there a way using your lib to get file content from a base64 string?

For instance, I am doing a similar thing using jpeg-js

    const jpegData = Buffer.from("<?php echo $image_file_content ?>", 'base64');
    const rawImageData = jpeg.decode(jpegData);
    const clamped_array = Uint8ClampedArray.from(rawImageData.data);
    const decodedGreenpass = window.jsQR(
          clamped_array,
         <?php echo $image_size[0]; ?>,
         <?php echo $image_size[1]; ?>
    );

I need to obtain in some way pngData or a Uint8ClampedArray

@realtebo realtebo changed the title Havine data passed from PHP, how can we handle the file? Having data passed from PHP, how can we handle the file? Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant