Not getting scanned notes to work

Hi @toddmleleux , the best way currently to donate is to become a github sponsor please and thank you!

Ok I was able to donate through my github acct and that link. Thanks again for the updates.

To use to ā€œrear facingā€ camera I edited the new.php file as such.

        async function startWebcam() {
            try {
            const stream = await navigator.mediaDevices.getUserMedia({
                video: { facingMode: "environment" } // Request forward-facing camera
            });

Todd

3 Likes

I’ll see if I can put an option in for this. Also I may take on adding multifile and will post updates here.
Also thanks for your generosity.

According to my use of that ā€˜environment’ variable, if its just a single camera or web camera there is no change as the app uses the available camera. If you have a tablet or smart phone it activates the picture camera and not the selfie camera. So i just run it hard coded as that as i see no reason someone would use selfie camera.

Todd

I know but i’m adding a camera pick.

HI

I went ahead and just created my own form called image_capture with the functions i was after. I put them on my github if anyone wants. GitHub - pathcoder4408/image_capture

Thanks Todd

Will test it and give you some feedback.

I thought everyone said it worked okay? So the mod in your version is the init camera?
I can update master for release.

The scanned notes works great. I wanted an image form with multiple image and selection capability so i made one.

Todd

You think it is ready for inclusion in openemr with your mod?

let me test for another day but it worked as planned for my test patients

Todd

I would make an edit to the report.php of scanned_notes. When uploading an image from smartphone the dimensions of the image are too big. I used this code to fix this issue.


/**
 * scanned_notes report.php
 *
 * @package   OpenEMR
 * @link      https://www.open-emr.org
 * @author    Rod Roark <rod@sunsetsystems.com>
 * @author    Brady Miller <brady.g.miller@gmail.com>
 * @copyright Copyright (c) 2006-2012 Rod Roark <rod@sunsetsystems.com>
 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
 * @license   https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
 */

require_once("../../globals.php");
require_once($GLOBALS["srcdir"] . "/api.inc.php");

function scanned_notes_report($pid, $useless_encounter, $cols, $id)
{
    global $webserver_root, $web_root, $encounter;

    // In the case of a patient report, the passed encounter is vital.
    $thisenc = $useless_encounter ? $useless_encounter : $encounter;

    $count = 0;

    $data = sqlQuery("SELECT * " .
    "FROM form_scanned_notes WHERE " .
    "id = ? AND activity = '1'", array($id));

    if ($data) {
        if ($data['notes']) {
            echo "  <span class='bold'>Comments: </span><span class='text'>";
            echo nl2br(text($data['notes'])) . "</span><br />\n";
        }

        for ($i = -1; true; ++$i) {
            $suffix = ($i < 0) ? "" : "-$i";
            $imagepath = $GLOBALS['OE_SITE_DIR'] . "/documents/" . check_file_dir_name($pid) . "/encounters/" . check_file_dir_name($thisenc) . "_" . check_file_dir_name($id) . check_file_dir_name($suffix) . ".jpg";
            $imageurl  = $web_root . "/sites/" . $_SESSION['site_id'] . "/documents/" . check_file_dir_name($pid) . "/encounters/" . check_file_dir_name($thisenc) . "_" . check_file_dir_name($id) . check_file_dir_name($suffix) . ".jpg";
            if (is_file($imagepath)) {
                // Get image dimensions
                $asize = getimagesize($imagepath);
                $width = $asize[0];
                $height = $asize[1];

                // Define maximum display width
                $maxWidth = 750; // Adjust this value as needed

                // Calculate scaled dimensions
                if ($width > $maxWidth) {
                    $scale = $maxWidth / $width;
                    $scaledWidth = $maxWidth;
                    $scaledHeight = intval($height * $scale);
                } else {
                    $scaledWidth = $width;
                    $scaledHeight = $height;
                }

                // Display the image with scaled dimensions
                echo "   <img src='$imageurl' width='$scaledWidth' height='$scaledHeight' style='max-width: 100%; height: auto;' />\n";
                echo " <br />\n";
            } else {
                if ($i >= 0) {
                    break;
                }
            }
        }
    }
}

Okay, Keep showing what you want and new code here and I’ll try to get to soon. Very busy right now.

i have tested the image_capture at my github and it performs as expected. you are welcome to include it with the future releases/patches as a contribution. The form was heavily modified from scanned_notes and I couldnt have made this without your efforts to add webcam and fix the existing scanned_notes form.

Todd

1 Like

I installed it as a separate form as Todd suggested. I am able to capture the images, the images are being saved in the folder but it is not being displayed in the form after saving. Only the text is showing not the images. This is after I click on save.