Image from iFrame result after image capture does not show.

Hi, I’m referenceing post Updating Dataset from iFrame result after image capture. I

I coded it exactly like in the post but this is not working for me. The file gets created/passed as only image.jpeg. The string without the actual image! If i print it in console.log, the string “image.jpeg” gets printed. So In the dataset there is an error for mismatch of field type since the string ‘image.jpg’ is being put there instead of url. If i use Sendgrid or something to send the file even base64 etc. the actual string ‘image.jpg’ gets sent. The problem is that the wix or entire document url isn’t available from the above code but just the string.

Any way to fix?

import {sendEmail} from ‘backend/email’ ;
import wixData from ‘wix-data’ ;

$w.onReady( () => {
//TODO: write your page related code here…
$w( “#dataset1” ).onReady(() => {
$w( “#dataset1” ). new ()
});
});

export function htmlcamera_message(event, $w) {
// Add your code for this event here:
console.log( “Camera Event Start” );
let receivedData = event.data;
let dateTime = new Date();

console.log( "Camera Event will save " + receivedData);

// I try to send the image here using base64 in sendEmail but the string ‘image.jpg’ gets sent!
sendEmail(receivedData)
.then(response => console.log( "sendemail failed " + response));

// I try to insert the image into the dataset the string ‘image.jpg’ gets inserted!

let toInsert = {
“timeStamp” : dateTime,
“new_image” : receivedData
};
wixData.insert( “dataset1” , toInsert)
.then( (results) => {
let item = results; //see item below
} )
. catch ( (err) => {
let errorMsg = err;
} );

}

html component code:

#btnCapture { background-color: #566FB8; color: white; border: none; height: 100px; width: 200px; padding: 10px 20px; text-align: center; font-family: 'Arial'; border-radius: 18px; } .label { font-family: 'Arial'; } .input { font-size: 24px; }

You wrote… " The string without the actual image!"
In your HTML code, the name (file.name) is exactly what you are passing…

window.parent.postMessage(file.name, "*");

Adding code to an HTML component is not a part of the Corvid product (which is what this forum is about). The basics of an HTML component is to put any HTML code in it. That code can be copied from any source that you want, but you need to know the exact code to put there (which is not related to Corvid)… You will need to check with the service provider to find out how to get it work.

what "service provider? the ISP? some ether-like creature from 1880’s physics? lol Why even have html component then? Anyway I dont care.

The original post which you replied to and used had the same exact code. Anyway I also tried just ‘file’ but that couldn’t be passed across iframes due to it being a a ‘blob’ as that blob url isn’t available outside the iframe.

Anyway will just migrate to some other “service provider” as you suggested.

By service provider, I mean either the author of the script, or the service that is being accessed by the script.

An HTML element allows you to add raw HTML or embed another website within your page, however Wix can’t provide support for HTML scripts as they are not part of the Corvid product.