PHP Classes

Problems with application

Recommend this page to a friend!

      PHP Classes blog  >  PHP Webcam Capture Im...  >  All threads  >  Problems with application  >  (Un) Subscribe thread alerts  
Subject:Problems with application
Summary:PHP Webcam Capture
Author:Fredrik Brandt
Date:2017-10-23 10:41:26
Update:2017-10-25 03:37:33

  1. Problems with application   Reply   Report abuse  
Fredrik Brandt - 2017-10-24 00:20:01
Hi and thanks for a great feature,

I am having problems retrieving the image data.
I have a db on my own I want to update, so my question is how to get hold of the image or image file name from my index-file where I have the update. I am using BLOB as the type.

I also get the webcam-display mirrored (in the display). Why is this?

Also, can I have this display in a second column from my web-page?
I have a registration that I want to have a picture to in the second column.


  2. Re: Problems with application   Reply   Report abuse  
Vivek moyal - 2017-10-24 05:41:43 - In reply to message 1 from Fredrik Brandt
What is second column ?

if you read the whole article you will see there are 2 types for saving the image to db.

1. Save the name only
2. save the image as base64 in your db

Webcam display will be mirrored but when you click the image it will not be mirrored

  3. Re: Problems with application   Reply   Report abuse  
Fredrik Brandt - 2017-10-25 03:37:33 - In reply to message 2 from Vivek moyal

By second kolumn I mean:
Kol 1 Kol 2
Registration of name etc. Take a picture
on several lines Display of picture with image name

I have these entries in my index.php-file.

I don't have a table called snapshot,
I have a table on my own where I want to update the image
(how is it possible later on to show the picture?).
I also have a visitcard where I want to put the image to print
(in styled place on the card).

In my index.php I have:
<script type="text/javascript">
function PrintDiv() {
var divToPrint = document.getElementById('visitcard');
var popupWin ='', '_blank', 'width=300,height=300');;
popupWin.document.write('<html><body onload="window.print()">'
+ '<img src="./images/logo-lexicon_30.gif">' + divToPrint.innerHTML + '</html>');

<!-- Show visitcard -->
<div class="card" id="visitcard">
<?php echo "";?><br>
<?php echo "";?><br>
<?php echo $firstname;?><br>
<?php echo $lastname;?><br>
<?php echo $course;?><br>
<?php echo $frdate;?><br>
<?php echo $todate;?>
<!-- <?php echo "<img src='".$image."'>";?> -->
<input type="button" name="print" value="Print" onclick="PrintDiv();" />

//-- Insert
$data = 1; //$image; //file_get_contents($_FILES['image']['tmp_name']);
$sql = "INSERT INTO " . $tbname . " (
firstname, lastname, image, course, frdate, todate, email)
VALUES ('$firstname','$lastname','$data','$course','$frdate','$todate','$email')";
if (mysqli_query($conn, $sql)) {
//echo "New record created successfully. <br>";
} else {
//echo "Error: " . $sql . "<br>" . $conn->error . " <br>";

Greatful for help :).
I have tried to modify the webcamClass.php (saveImageToDatabase)
with f.ex. trying to set an environment variable that I later on reads from index.php without any luck.
I want to use the $image (or $imageurl) from here that I have taken.

(Besides, if I take another picture it will display beneath the previous taken picture and so on, and I only want one to be displayed. How can this be avoided?)