I have been working on some QR codes, I need to pass an array to the QR with the data but it needs encoding. The data itself is a
json_array which is used to generate a PDF.
If I use
base64 encoding the QR code is stupidly large, and when using
ascii85 it breaks the QR.
Can you let me know of any encoding praticies which would work in the url, the shorted the coding the
What is the proper way to convert a byte  to a Base64 string in Java? Better yet would be Grails / Groovy because it tells me that the
encodeAsBase64() function is deprecated. The
sun.misc.BASE64Encoder package isn't recommended for use and outputs a different size string on some Windows platforms.
i have an image that is converted to a base64 string in the frontend and i have to attach it inside my email service as an attachment. i have read about this API CreateAttachmentFromString(String, String, Encoding, String) in Attachment Class. the first argument is the encoded string which would be my base64 string and third one is encoding.
What should be value for this encoding argument if its base 64 string. i have searched the System.Text.Encoding class but there is no reference to it.
string encodedAttachment = emailData.AttachmentData.Substring(emailData.AttachmentData.IndexOf(",") + 1);byte data1 = Convert.FromBase64String(encodedAttachment);string decodedString = Encoding.UTF8.GetString(data1);Attachment data = Attachment.CreateAttachmentFromString(decodedString, emailData.AttachmentName, System.Text.Encoding.UTF8, MediaTypeNames.Application.Octet);email.Attachments.Add(data);
Still the attachment sent isnt right.
I want to get the image in the clipboard and convert its data into a base64 encoded string so that I can put that into a HTML img tag.
I've tried the following:
from PIL import ImageGrabfrom base64 import encodestringimg = ImageGrab.grabclipboard()imgStr = encodestring(img.fp.read())
Plus some other combinations, all of which give me incorrect representations of the image.
I'm struggling with the docs on this one; does anyone have an idea on how to accomplish this?
I use a php script to query our LDAP and output the results to HTML - now I also want to get the thumbnailphoto but I struggle to convert the encoded image.
The image data looks like this:
$data = $ldapResults[$i]['thumbnailphoto'];echo "<td>" .$data . "</td>";
I found this post @stackoverflow but I can't get it to work.
What do I need to do to display the image properly?