Decode Base64 string as image and Display using .image property in Powerapps - base64

This isn't a question, but I wanted to share the solution since I wasn't able to find much about it googling.
I am creating a tool for my company using PowerApps. I needed to store a set of data along with 2 pictures for each entry. The data and pictures were stored in pdf files, I parsed the data out, and encoded the pictures into a base64 string (Field: VarChar MAX), using PowerShell and uploaded it into a SQL (2005) server onsite. I connected my onsite SQL server to PowerApps through the Gateway program provided by PowerApps.
My problem was displaying the stored pictures in the application, without using any different data connectors or extreme coding.
Using the IMAGE object, Image.image = "data:image;application/octet-stream;base64,"&PassingID.PictureOpen
where PassingID.PictureOpen = the Base64 string.

Using the IMAGE object, Image.image = "data:image;application/octet-stream;base64,"&PassingID.PictureOpen
where PassingID.PictureOpen = the Base64 string.
The really important part here is using quotes "", and data:image;application/octet-stream;base64,
You can replace image with audio, for audio features.
I assume a similar setup can be used in the Gallery object as well.

Related

A Study on the Modification of PDF in nodejs

Project Environment
The environment we are currently developing is using Windows 10. nodejs 10.16.0, express web framework. The actual environment being deployed is the Linux Ubuntu server and the rest is the same.
What technology do you want to implement?
The technology that I want to implement is the information that I entered when I joined the membership. For example, I want to automatically put it in the input text box using my name, age, address, phone number, etc. so that the user only needs to fill in the remaining information in the PDF. (PDF is on some of the webpages.)
If all the information is entered, the PDF is saved and the document is sent to another vendor, which is the end.
Current Problems
We looked at about four days for PDFs, and we tried to create PDFs when we implemented the outline, structure, and code, just like it was on this site at https://web.archive.org/web/20141010035745/http://gnupdf.org/Introduction_to_PDF
However, most PDFs seem to be compressed into flatDecode rather than this simple. So I also looked at Data extraction from /Filter /FlateDecode PDF stream in PHP and tried to decompress it using QPDF.
Unzip it for now.Well, I thought it would be easy to find out the difference compared to the PDF without Kim after putting it in the first name.
However, there is too much difference even though only three characters are added... And the PDF structure itself is more difficult and complex to proceed with.
Note : https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf (PDF official document in English)
Is there a way to solve the problem now?
It sounds like you want to create a PDF from scratch and possibly extract data from it and you are finding this a more difficult prospect than you first imagined.
Check out my answer here on why PDF creation and reading is non-trivial and why you should reach for a tool you help you do this:
https://stackoverflow.com/a/53357682/1669243

how to get and display photo from ldap

I'm using ldap3.
I can connect and read all attributes without any issue, but I don't know how to display the photo of the attribute thumbnailPhoto.
If I print(conn.entries[0].thumbnailPhoto) I get a bunch of binary values like b'\xff\xd8\xff\xe0\x00\x10JFIF.....'.
I have to display it on a bottle web page. So I have to put this value in a jpeg or png file.
How can I do that?
The easiest way is to save the raw byte value in a file and open it with a picture editor. The photo is probably a jpeg, but it can be in any format.
Have a look at my answer at Display thumbnailPhoto from Active Directory in PHP. It's especially for PHP but the concept is the same for Python.
basically it's about either using the base64 encoded raw-data as data-stream or actually using a temporary file that is serverd (or used to determine the mime-type)

Cannot Extract Images from Lotus Notes using Java API

I am working on a Data extract from a Lotus Notes Application. It stores legal documents which may have attachments and images (not mails). I want to convert notes documents to HTML. While importing the data using java API I am able to extract Text, Attachments etc but when it comes to images I am not able to extract them. I did some research and found about two approaches
1) To extract the document using generateXML() method. But the generated document contains a picture tag which has a referenece of location on Notes Domino server. But I want the image so that it can be included in the HTML document.
2) By extractinh as MIME Entity. When I try to get images using getMIMEEntity("Body") or any other field I do not get any image and It always return null.
There is question (Extract inline images from Lotus Notes using Lotus Notes Java API) which deals with this but It does not answers conclusively and its dormant for a long time.
Please help, I am working on it for a couple of days still I cannot import images. Thanks in advance.
In Lotusscript you can first Extract file to your local system/ Server and than export in excel by using that code below.
' Loop through all attachment/document (By creating attachment object)and save Image to some path on server/local 'system(strSaveasPath)
Call object.ExtractFile( strSaveAsPath)
' Now Activate excel row:column range where you wnat to insert image
xlApp.Range("1:1").Activate
xlApp.ActiveSheet.Pictures.Insert(strSaveAsPath)

Image manipulation in NodeJS with base64 image data

I have a nodejs server that receives images encoded in base64 through a websocket. I would like to do some image manipulation on those images and send them back. I searched a little bit on the net to find some library to help me doing this, but all I could find were libraries that take images stored somewhere in the server side, do the manipulation and save back the image. Apparently all of them take as input a string containing the filename of the image, so I guess under the hood they are fetching the image manually through a file stream.
My question is, is there a library that may help me working directly on base64 data (that is, passing the data as input to the functions) or should I save every time the image on the server, modify it and send it back? I would rather not go with the latter because I'm working on some high-performance application, and all this saving/loading looks a waste of cycles. Otherwise, do you see some other way I could achieve this (that is, getting the image file without saving and loading it back, for example)?
Thanks.
Work with Buffers.
var img = new Buffer(img_string, 'base64');
// Work with your images like other tutorials do.
This one can work with "readable streams": https://github.com/aheckmann/gm
See the second set of examples in the readme.

Render image or pdf stream from SQL database in asp.net

I have a table with documents saved some of them in pdf, some of them image.
I want to create a web app, to show the images (that can be either pdf, either jpg) in the same control.
I can manage to see pdf, if I set the Response.ContentType = "application/pdf" or image if I set "application/jpg". But the problem is that how can I get the file type, having only the stream saved into the database? Does it have the stream the file type information in it?
Thanks.
No, a stream does not have a content type associated with it. If you had the original filename, you could attempt to derive the content type from that, but it wouldn't be foolproof.
Many file formats have a series of "magic bytes" that allow you to detect what (might) be in the file. PDF, for example, begins with the bytes "%PDF" (note: I'm not an expert on PDF, and there may be situations where that is not true).
If you have no other option, you could attempt to parse the file using various libraries until you found one that worked (System.Drawing.Image.FromStream(), iTextSharp, etc).

Resources